Environment: MySQL Sever 5.1 + MySQL command line tool
Problem: MySQL command line login
Solve:
command-line logon syntax:
Mysql–u user name [–h host name or IP address]–p password
Note: The user name is the user you logged in, the hostname or IP address is optional, if the local connection is not required, the remote connection needs to fill in, the password is the corresponding user's password.
Attention:
1. The command is executed under the Windows command-line window, not the command line of MySQL;
2. Enter-p after the password can be directly followed, you can also press ENTER, will prompt you to enter the password, both are the same effect;
3.–p password option is not necessarily to be at the end;
No spaces after 4.–u,-H,-P.
Example:
--Local connection mysql–uroot-p --Remote connection mysql–uwgb–hxxx.xxx.xxx.xxx–p
Example of MySQL command line login