Home  >  Article  >  Database  >  How to open mysql with cmd command?

How to open mysql with cmd command?

藏色散人
藏色散人Original
2019-05-08 09:51:1549057browse

How to open mysql with cmd command?

How to use the CMD command to open and enter the MySQL database under Windows?

1. Open [Start]>>[Run] and enter [cmd] and click [OK] to appear. The CMD command has a black window. This is what we call the CMD command line, or you can use the shortcut Windows key (there is a key with the Windows logo on the keyboard) R. Enter cmd and press Enter.

2. Type the command

mysql -hlocalhost -uroot -p

in the CMD command window and press Enter (note that "-h", "-u", and "-p" here cannot be omitted) to enter the mysql database , where "-h" represents the server name, 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 , such as: -p888888, 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, first use the DOS command to enter the bin directory under the MySQL installation directory. The method is as follows: enter G: to enter the G drive), enter cd G:\phpstudy\mysql\bin to enter the MySQL bin directory, then enter mysql -hlocalhost -uroot -p and press the Enter key.

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

Statement:
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