Home > Database > Mysql Tutorial > body text

How to open mysql from the command line?

青灯夜游
Release: 2020-10-05 10:36:56
Original
65794 people have browsed it

How to open 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 return Click to open the mysql database.

How to open mysql from the command line?

How to open mysql on the cmd command line

1. Windows in the lower left corner of the desktop Icon--Enter cmd in the search box. The result is as shown in the picture. Click cmd.exe, or use the shortcut Windows key (there is a key with the Windows logo on the keyboard) R. Enter cmd and press Enter.

How to open mysql from the command line?

How to open mysql from the command line?

#2. Start the mysql database: Enter net start mysql in the DOS command window that comes out, or use the shortcut Windows key (in There is a button with the Windows logo on the keyboard) R directly enter net start mysql and press Enter. (Attached: the shutdown command is net stop mysql)

How to open mysql from the command line?

How to open mysql from the command line?

##3. Enter mysql -hlocalhost -uroot -p in the DOS command window Press Enter to enter the mysql database, where -h represents the server name and localhost represents the local area; -u is the database user name, and root is the mysql default user name; -p is the password. If a password is set, you can directly enter it in the link after -p. For example: -p123456, the user has not set a password. When Enter password is displayed, just press Enter.

Note that if your mysql is not installed on the C drive, you need to first use the DOS command to enter the bin directory under the mysql installation directory. Taking my computer as an example, the method is as follows: enter D: to enter the D drive, enter cd D:\Tools\MySQL5.5.25\bin to enter the bin directory of mysql, and then enter mysql -hlocalhost -uroot -p

How to open mysql from the command line?

4. When this interface is displayed, it means that you have successfully connected to the mysql database

How to open mysql from the command line?

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

How to open mysql from the command line?

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

How to open mysql from the command line?

Recommended tutorial:

mysql video tutorial

The above is the detailed content of How to open mysql from the command line?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template