How to open mysql from the command line

The method of opening mysql on the command line: first enter "net start mysql" in the cmd command line; then enter "mysql -hlocalhost -uroot -p" and press Enter; finally enter the mysql account password and press Enter to open the mysql database .

How to open mysql on the cmd command line

1. Windows icon in the lower left corner of the desktop – enter cmd in the search box, the result is as shown in the figure, click cmd.exe, or use the shortcut key Windows key (the key with the Windows logo on the keyboard) + R to enter cmd and press Enter.

2. Start the mysql database: Enter net start mysql in the DOS command window that comes out, or use the shortcut key Windows key (the key with a Windows logo on the keyboard) + R to directly enter net start mysql and press Enter. (Additional: The command to close is net stop mysql)

3. In the DOS command window, enter mysql -hlocalhost -uroot -p and press Enter to enter the mysql database, where -h indicates the server name, localhost indicates the local; -u is the database user name, root is the default user name of mysql; -p is the password, If a password is set, it can be entered directly after -p, such as: -p123456, if the user has not set a password, when Enter password is displayed, just press Enter.

Note, if your mysql is not installed under the C disk, you need to use the DOS command to enter the bin directory under the mysql installation directory. Take my computer as an example, the method is as follows: Enter D: to enter the D drive, enter the mysql bin directory after entering cd D: ToolsMySQL5.5.25in to enter mysql -hlocalhost -uroot -p

4. When this interface is displayed, it means that it has successfully linked to the mysql database

5. Enter show databases; display the database you have (commands in the mysql database must end with a semicolon ";")

6. If you want to exit the mysql database, enter exit; press Enter

Guess you like

Origin blog.csdn.net/m0_65121454/article/details/129778857