1. We installed the MySQL database by default when installing the rhel as system. In this installation method, the initial password of the root account of the database is null.
Because some customers do not have strong security awareness, they directly enable the database after receiving the system, leaving security risks.
Therefore, the technical department must set the initial password of the MySQL database after installing the rhel as system.
The method is as follows:
After the system is installed, log on to the system, use the SETUP program, modify the default service items of the system, enable the mysqld service, and restart the server.
Or/etc/init. d/mysqld start to temporarily enable the mysql service.
Enter the command:/usr/bin/mysqladmin-u root-p password ****** (the new password is displayed in plaintext, requires the same setting rules as the system logon password). After you press enter, you will be prompted to enter the original password. Because the initial password is blank, you can press enter directly.
Verification:
1. Enter mysql-u root-p in any path and press enter to enter the password. Enter the new password and enter the Database Manager.
Use exit or quit to exit the database management program from the system.
2. Modify the config. inc. php file.
3. In the Mysql environment, you can use the following statement to set the password: (not tested)
A. insert into user (host, user, password) values ('%', 'user _ name', password ("your password ");
B. set password for user_name = password ("your password ")
The above two methods must be used to reload the authorization table.
C. Of course, you can set a password when creating a user. The grant statement will automatically encrypt the password for you.
For example
Grant all on *. * to user_name @ % identified by "your password ";
In addition, you can use the mysqladmin program in the shell environment to set the password.
For example
Mysqladmin-u root password "your password"