---restore content starts---
0x01
The order in which the configuration files are read when MySQL starts
Default options is read from the following files in the given order:
/ETC/MYSQL/MY.CNF/ETC/MY.CNF ~/.my.cnf
How to use the configuration file
1. It looks for multiple files to look up in turn, and the result is all file intersections
2. If a parameter appears multiple times in more than one file, the final configuration will take effect
You can use MySQL--help--verbose to view
1. Displays the options that are available when the MySQL program starts, usually with a long option
2. Display the service variables available in the MYSQLD configuration file
MySQL > Show global variables
MySQL > Show Session variables
0x02
1. After the MySQL database is installed, the first initialization is to delete the anonymous user
What anonymous users are queried
Select Host,user,password from Mysql.user;
Delete the corresponding anonymous user, the actual situation, can be deleted according to the actual situation.
Drop user ' @ ' localhost ';
Drop user ' @ ' stuphp.hping3.com ';
User name account consists of two parts: [email protected]
The host can also use a wildcard character
%: Any character of any length
_: Match any single word
2. Set the password for all root users
The first way to change the password:
Instance---> MySQL > Set password for [email protected] = password (' photon ');
Format---> mysql > Set password for [email protected] = password (' Your_password ')
The second way to change the password:
The way to modify the password is to directly modify the user table under MySQL, all to be advanced to the user table to execute
so use MySQL;
Update user Set Password = password (' redhat ') where user = ' root ';
Let it take effect immediately----notify mysqld to re-read the user table
Flush privileges;
The third method modifies the password:
Example---->
Mysqladmin-uroot-hlocalhost password ' photon '-p----localhost is a host IP
Mysqladmin-u root-h localhost-p flush-privileges----Let it take effect
Format---->
Mysqladmin-u username-h hot password ' new_password '-p
Mysqladmin-u username-h host-p flush-privileges
MySQL Learning-----(2)