MySQL is a real multi-user, multi-threaded SQL database server. MySQL is implemented as a client/server architecture, consisting of a server daemon mysqld and many different client programs and libraries. Because of its open source and stability, and with the perfect combination of PHP, now many sites are used as a back-end database, so that it has been widely used. Security considerations require that each user be assigned access restrictions to different databases to meet the requirements of different users. The following is discussed separately for your reference.
A, MySQL modified password method summary
The first thing to say is: Under normal circumstances, to modify the MySQL password is required to have the root of MySQL, so the average user can not change the password, unless the administrator to help modify.
Method One
Using phpMyAdmin
(graphical management of MySQL database Tools), this is the simplest, directly with SQL statements to modify the MySQL Database Library user table, but do not forget to use the password function, insert the user with the Insert command, modify the user with the update command, delete the deletion with the delete command. A detailed description of the data table User field is available later in this section.
Method Two
Use Mysqladmin. Input
mysqladmin -u root -p oldpassword newpasswd
After executing this command, you need to enter the original password of root, so that the root password will be changed to NEWPASSWD. Again, change the command root to your username, and you can change your password.
Of course, if your mysqladmin is not connected to MySQL server, or you have no way to execute mysqladmin, then this method is invalid, and mysqladmin cannot empty the password.
The following methods are used at the MySQL prompt and must have the root permissions of MySQL:
Method Three
mysql> INSERT INTO mysql.user (Host,User,Password) VALUES
('%','system', PASSWORD('manager'));
mysql> FLUSH PRIVILEGES
Specifically, this is adding a user named system with a password of manager. Note that you want to use the password function, and then use flush privileges to perform the validation.
Method Four
And method Three, just use the Replace statement
mysql> REPLACE INTO mysql.user (Host,User,Password)
VALUES('%','system',PASSWORD('manager'));
mysql> FLUSH PRIVILEGES
Method Five
Using the Set Password statement
mysql> SET PASSWORD FOR system@"%" = PASSWORD('manager');
You must also use the password () function, but you do not need to use flush privileges to perform the validation.
Method Six
Use Grant ... Identified by statement to authorize.
mysql> GRANT USAGE ON *.* TO system@"%" IDENTIFIED BY 'manager';
This password () function is unnecessary and does not require the use of flush privileges to perform validation.
Note: PASSWORD () function is to encrypt password, in the program MySQL automatic interpretation.