1. Connecting to the database server
$./mysql-h Host_name-u User_name-p
-H HOST_NAME (--host=host_name), the connected database hostname, can be omitted if on the local host.
-U user_name (--user=user_name), database username, on UNIX systems, can be omitted if the system's login name is the same as the data user name. In Windows systems, you can give a database user name, such as set User=username, by setting the environment variable user.
-P (--password), provides the database user password, which MySQL will prompt you to enter the password. The password you enter is displayed with an asterisk to ensure security. You can also write the password directly after-P (p and the password can not have spaces), but this is not safe, not recommended.
After the connection is successful, the MySQL database server displays some welcome information. The specified database can then be opened with the Mysql>use database_name command.
The $./mysql-h host_name-u user_name-p database_name command opens the specified database directly.
2. Update user password
Mysql>update user Set PASSWORD=PASSOWRD (' Your passowrd ') where host= '% ';
Refresh permission settings: Mysql>flush privileges;
3. mysql read the order of the configuration file
MY.CNF is a MySQL database configuration file that exists in several places, in the/etc directory, in the data directory, and in the user's home directory. Placed in different positions, the options inside have different scope, the following is the MySQL read the configuration file order and function.
MySQL reads the order of the configuration files:
/ETC/MY.CNF Global Options.
DATADIR/MY.CNF server-specific Options.
Defaults-extra-file the file specified with the--defaults-extra-file option.
~/.MY.CNF user-specific Options.