Home >Database >Mysql Tutorial >What are the ways to log in to MySQL from the command line?
Start Menu-> All Programs-> MySQL -> MySQL Server 8.0 -> MySQL 8.0 Command Line Client
##Method 2: cmd command line clientmysql -h host name -P port number -u user name -p password For example: mysql -h localhost -P 3306 -u root -proot(1) There can be no spaces between -p and the password. There can be spaces or no spaces between other parameter names and parameter values.
mysql -hlocalhost -P3306 -uroot -proot
(2) It is recommended that the password be entered on the next line
mysql -h localhost -P 3306 -u root -p Enter password:****
(3) If it is connected to the local machine: -hlocalhost can be omitted. If the port number has not been modified: -P3306 can also be omitted.
is abbreviated as:
mysql -u root -p Enter password:******
(4) If the mysql command is entered, it will report "Not internal" Or external command", configure the bin directory of the mysql installation directory into the environment variable path
The above is the detailed content of What are the ways to log in to MySQL from the command line?. For more information, please follow other related articles on the PHP Chinese website!