Han Ligang Teacher Video teaching website http://www.91xueit.com
Mr. Han QQ458717185
No. 01. mysql User and Rights management
MySQL permissions control is controlled by two steps, can not connect (authenticate user identity), what action (verify user rights).
Verify user identity, need to verify the IP address or computer name, user account and password of the computer that is connected to MySQL. The verification process is as follows:
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m02/79/85/wkiom1atfvqi8vzkaacvwsb7blm388.png "width=" 538 "height=" "/>"
Manage MySQL users view MySQL user account
MySQL users are stored in the user table in the MySQL database, which is automatically loaded into memory when the MySQL service starts and controls the user's login.
[Email protected] ~]# mysql-u root
View the users who are currently connected to MySQL.
Mysql>select user ();
mysql> use MySQL;
Mysql> select User,host from user;
The chart underlines the record, which represents the ability to log in to MySQL locally using any user. Ability to view MySQL's system variables, but with low permissions.
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m02/79/84/wkiol1atfyrshvjxaaa3gqtiyv8980.png "width=" 419 "height=" 296 "/>
Mysql> quit;
Log in to MySQL with any user name and find it all successful.
[Email protected] ~]# Mysql-u Wang
To view the login username, you can see that it is [email protected].
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m00/79/84/wkiol1atfyqsnn5waaaaizycjp8442.png "width=" 281 "height=" "/>"
You can perform some view commands.
Mysql> SELECT @ @version;
Mysql> Show variables;
Mysql>use MySQL;
Mysql> quit;
Log in with the root account.
[Email protected] ~]# mysql-u root
Mysql>use MySQL;
mysql> Delete from user where user= ';
Query OK, 2 rows Affected (0.00 sec)
Mysql> quit
Restart MySQL Service
[Email protected] ~]# service mysqld restart
Log on again using Wang, failed.
[Email protected] ~]# Mysql-u Wang
ERROR 1045 (28000): Access denied for user ' Wang ' @ ' localhost ' (using Password:no)
Create a MySQL user account
[Email protected] ~]# mysql-u root
mysql> use MySQL;
The MySQL user name is case-sensitive, as shown below for two users when different accounts. The user account created below does not specify a password and does not need to be entered at logon.
mysql> create user [email protected] ' 192.168.80.% ';
mysql> Create user [email protected]' 192.168.80.% ';
mysql> Create user Wang;
Mysql> select User,host from user;
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m01/79/85/wkiom1atfv3dbwqaaabesvglyya644.png "width=" 430 "height=" 352 "/>
Set the MySQL user password
Set [email protected] ' 192.168.80.% password for ' 91xueit.com '
mysql> Set password for [email protected] ' 192.168.80.% ' =password (' 91xueit.com ');
Set the [email protected] ' localhost ' account password to ' 91xueit.com '.
mysql> Set password for [email protected] ' localhost ' =password (' 91xueit.com ');
Query OK, 0 rows Affected (0.00 sec)
Mysql> quit
Using Zhang to connect to MySQL, use the-h parameter to specify the MySQL server address to connect to, using-p to indicate the password to enter.
[Email protected] ~]# mysql-u zhang-h 192.168.80.222-p
Enter Password:
Specify a password when creating a user
mysql> create user [email protected] ' 192.168.80.% ' identified by ' 91xueit.com ';
Grant way to create user
The following command creates user and authorization at the same time, authorized user [email protected]' 192.168.80.% ' can query all tables of SCHOOLDB database, password is ' 91xueit.com '.
Mysql> Grant Select on schooldb.* to [e-mail protected] ' 192.168.80.% ' identified by ' 91xueit.com ';
Create users by inserting records into the user table
By creating a user with the Create or Grant command, MySQL triggers a reload of the user table into memory, a new user can log in, and if you insert a record directly into the user table, you need to refresh the permissions to allow MySQL to load the user table before the new users can log in.
mysql> INSERT INTO Mysql.user (User,host,password) VALUES (' Luo ', ' 192.168.80.% ', password (' 91xueit.com '));
Logon failure
[Email protected] ~]# mysql-u luo-h 192.168.80.222-p
Enter Password:
ERROR 1045 (28000): Access denied for user ' Luo ' @ ' 192.168.80.222 ' (using Password:yes)
Refresh the permissions to load the user table into memory.
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
Log in again, success!
[Email protected] ~]# mysql-u luo-h 192.168.80.222-p
Enter Password:
or enter the following command,-U followed by the user name,-p followed by the password, note: Immediately refers to no space.
[Email protected] ~]# mysql-uluo-p ' 91xueit.com '
User name wildcard character
The host can use wildcard characters, and the rules are exactly the same as those defined in the standard SQL syntax.
% corresponds to any length of character.
_ corresponds to any character of one length
When the MySQL service starts, the user table is transferred into memory, and in-memory the users account is sorted. For example there are several users in the sort from top down for:
Zhang | 192.168.80.222
Zhang | 192.168.80.%
Zhang | 192.168.%
Zhang | %
There is a wildcard in the following, the more specific in the above, the user login to enter the account Zhang, in the end, which account to look at the IP address of the client, from the top down comparison, as long as the match is considered to be the user.
Delete MySQL User
Deleting a user record directly from the MySQL table does not trigger MySQL to reload the user table into memory, the user can still log in to MySQL, but executes the flush privileges command, and MySQL reloads the user table. The deleted user cannot log on.
mysql> use MySQL;
mysql> Delete from user where user= ' Luo ';
mysql> flush Privileges;
Mysql> quit
Deleting a user with the drop command triggers MySQL to reload the records in the user table into memory. Deleted users will not be able to connect to MySQL.
mysql> drop user [email protected] ' 192.168.80.% ';
Authorizing MySQL users to access the database MySQL permission level
Authorization is to grant permissions to a user, and MySQL permissions control granularity from large to small:
Global hierarchy
Global permissions apply to all databases in a given server. These permissions are stored in the Mysql.user table. Grant all on * * and REVOKE all on * * ONLY GRANT and REVOKE global permissions.
Database hierarchy
Database permissions apply to all targets in a given database. These permissions are stored in the mysql.db and Mysql.host tables. Grant all ondb_name.* and revoke all on db_name.* only grant and REVOKE database permissions.
Surface level
Table permissions apply to all columns in a given table. These permissions are stored in the Mysql.talbes_priv table. Grant all on db_name.tbl_name and revoke all on Db_name.tbl_name only grant and revoke table permissions.
Column hierarchy
Column permissions apply to a single column in a given table. These permissions are stored in the Mysql.columns_priv table. When using revoke, you must specify the same columns as the authorized column.
Sub-Program Level
CREATE ROUTINE, ALTER ROUTINE, execute and grant permissions apply to stored subroutines. These permissions can be granted at the global level and at the database level. Furthermore, in addition to the Create routine, these permissions can be granted as sub-program levels and stored in the Mysql.procs_priv table.
When a subsequent target is a table, a stored function, or a stored procedure, the OBJECT_TYPE clause should be specified as table, function, or procedure. When the My global permissions from the previous version are stored in the MySQL database user table, the database permissions are stored in the DB table of the MySQL database, the table permissions are stored in the Tables_priv table in the MySQL database, and the column permissions are stored in the Columns_priv table.
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m02/79/85/wkiom1atfv_rgjfmaab7qxmfsz8762.png "width=" 541 "height=" 681 "/>
The process by which the client validates permissions.
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m02/79/84/wkiol1atfzdj0okaaackcnusfou986.png "width=" 739 "height=" 829 "/>
Grant Column Permissions
Grant ' Zhang ' @ ' 192.168.80.% ' to query and change the Studentid,sname column of the Schooldb.tstudent table.
Mysql> Grant Select (studentid,sname) on schooldb.tstudent to ' Zhang ' @ ' 192.168.80.% ';
Mysql> Grant Update (studentid,sname) on schooldb.tstudent to ' Zhang ' @ ' 192.168.80.% ';
You can see the permissions granted by querying the permissions table for a column.
SELECT * FROM Mysql.columns_priv
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m00/79/86/wkiom1atfwoznomcaaav8zwp-sa549.png "width=" 861 "height=" "/>"
Column permissions for the grant
Use the graphical interface management tool to connect to MySQL using the Zhang user.
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m01/79/84/wkiol1atfzsqnk3daadg2dbw4lq820.png "width=" 606 "height=" 467 "/>
Select the SCHOOLDB database, select the client character set, and click "Finish".
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m01/79/86/wkiom1atfwjx50egaadkv3fviws360.png "width=" 606 "height=" 467 "/>
Query StudentID, sname two columns succeeded.
Select Studentid,sname from Tstudent
Failed to query all columns.
SELECT * FROM Tstudent
SELECT command denied to user ' Zhang ' @ ' 192.168.80.2 ' for table ' tstudent '
Update name success
Update tstudent set sname= ' Han Li just ' where studentid= ' 00001 '
Failed to update the email column.
Update tstudent set email= ' [email protected] ' where studentid= ' 00001 '
UPDATE command denied to user ' Zhang ' @ ' 192.168.80.2 ' for column ' email ' in table ' Tstudent '
Remove permissions granted to access columns
Delete the permission to access the Tstudent table column previously granted by ' Zhang ' @ ' 192.168.80.% '.
mysql> Revoke Select (Studentid,sname) on schooldb.tstudent from ' Zhang ' @ ' 192.168.80.% ';
mysql> revoke Update (STUDENTID,SNAME) on schooldb.tstudent from ' Zhang ' @ ' 192.168.80.% ';
Using an SQL statement, you can also authorize users to query and change the specified columns of a table.
Mysql> Grant Select (studentid,sname), update (Studentid,email) on schooldb.tstudent to ' Zhang ' @ ' 192.168.80.% ';
You can see the permissions granted by querying the permissions table for a column.
SELECT * FROM Mysql.columns_priv
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m02/79/86/wkiom1atfwnrz8ctaaa6wkvvjl4315.png "width=" 855 "height=" 117 "/>
Remove the permissions for the authorization.
mysql> Revoke Select (studentid,sname), update (Studentid,email) on schooldb.tstudent from ' Zhang ' @ ' 192.168.80.% ';
Grant Table Permissions
Give the user ' Zhang ' @ ' 192.168.80.% ' to schooldb.tstudent table can be deleted and modified.
Mysql> Grant Select on Schooldb.tstudent to ' Zhang ' @ ' 192.168.80.% ';
Mysql> Grant Update,delete,insert on Schooldb.tstudent to ' Zhang ' @ ' 192.168.80.% ';
Query the permission table for a column, and you can see that the table has no records.
SELECT * FROM Mysql.columns_priv
You can see the permissions granted by querying the table's permissions table.
SELECT * from Tables_priv;
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m00/79/86/wkiom1atfwrd0ug7aaaiix_232a212.png "width=" 839 "height=" "/>"
To cancel table-level permissions
mysql> revoke update on schooldb.tstudent from ' Zhang ' @ ' 192.168.80.% ';
Mysql> revoke delete,insert,select on schooldb.tstudent from ' Zhang ' @ ' 192.168.80.% ';
Grant data-level permissions
Give the user Select, delete, update, and insert permissions on all tables in the database, and schooldb.* "*" represents all tables for SCHOOLDB.
Mysql> Grant Select on schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Mysql> Grant Insert,delete,update on schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
The following command grants the user permission to create tables in the database.
Mysql> Grant create on schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
The following command grants the user permission to create a view.
Mysql> Grant CREATE view on schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
View the database-level permissions table. Y represents the permission that corresponds to the column, and n means that there is no permission for that column.
SELECT * from DB;
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m00/79/84/wkiol1atfzmdp7lbaaa0xncwrnc383.png "width=" 874 "height=" 142 "/>
Grant the user full access to the database,
Mysql> grant all privileges in schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Or
Mysql> Grant all on schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Cancels all database-level permissions granted to the user, and this command does not remove the permissions granted at the table-level and column-level.
Mysql> revoke all privileges on schooldb.* from ' Zhang ' @ ' 192.168.80.% ';
Using the WITH GRANT option parameter, ' Zhang ' @ ' 192.168.80.% ' can authorize other users to have the appropriate permissions, you cannot grant other users the permissions you do not have;
Mysql> Grant all on schooldb.* to ' Zhang ' @ ' 192.168.80.% ' with GRANT option;
Cancels the granted permission.
Mysql> revoke all on schooldb.* from ' Zhang ' @ ' 192.168.80.% ';
Remove permissions from the user to authorize other users.
Mysql> revoke grant option on the schooldb.* from ' Zhang ' @ ' 192.168.80.% ';
Grant Global Permissions
Grant ' Zhang ' @ ' 192.168.80.% ' Global SELECT permission.
Mysql> Grant SELECT On * * to ' Zhang ' @ ' 192.168.80.% ';
View the user table of the MySQL database to see the global permissions granted,
select * from user;
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m01/79/86/wkiom1atfwzcczzpaaa_nqjs-ju096.png "width=" 854 "height=" 168 "/>
Grant ' Zhang ' @ ' 192.168.80.% ' Global full permissions.
Mysql> Grant All on * * to ' Zhang ' @ ' 192.168.80.% ';
To see the user table of the MySQL database again, you can see that the ' Zhang ' @ ' 192.168.80.% ' users have all the global permissions.
select * from user;
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m00/79/86/wkiom1atfw7sjtc3aaa_jltx_8m462.png "width=" 854 "height=" 173 "/>
To view granted permissions
View the permissions of the current user.
Mysql>show grants;
Use the following command to view the access granted to ' Zhang ' @ ' 192.168.80.% '.
Mysql> show grants for ' Zhang ' @ ' 192.168.80.% ';
Revoke a user's permissions granted at a certain level
When revoking permissions granted to a user, consider which level of permissions to revoke.
Entering the following command revokes all global permissions for the user, and the command does not revoke the data-level permissions granted to the user and the permissions at the table-level and column-level.
Mysql> revoke all on * * from ' Zhang ' @ ' 192.168.80.% ';
Entering the following command revokes all user schooldb database-level permissions. The command does not revoke permissions granted to the user at the table and column levels.
Mysql> revoke all on schooldb.* from ' Zhang ' @ ' 192.168.80.% ';
Enter the following command to revoke all user access to the Tstudent table. The command does not revoke permissions granted to the user at the column level.
Mysql> revoke all on schooldb.tstudent from ' Zhang ' @ ' 192.168.80.% ';
Entering the following command revokes the user's query access to the StudentID, sname columns of the Tstudent table.
mysql> Revoke Select (Studentid,sname) on schooldb.tstudent from ' Zhang ' @ ' 192.168.80.% ';
Use the graphical interface to view set permissions
Using MySQL Manager connection, click 650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px; border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt = "image" src= "Http://s3.51cto.com/wyfs02/M01/79/86/wKiom1aTfW7DM6ghAAAIhc3wGwU487.png" width= "height=" 35 "/ , the interface to manage MySQL users, you can see all the existing users, you can create new users, delete users, edit the user, you can see the user's global permissions.
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m02/79/86/wkiom1atfxxwbqbwaagsaboqhkk866.png "width=" 1094 "height=" 676 "/>
Click in 650) this.width=650; "Style=" background-image:none;margin:0px;padding-left:0px;padding-right:0px; border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt = "image" src= "Http://s3.51cto.com/wyfs02/M02/79/86/wKiom1aTfXXSWpG3AAAHWuXnFH4627.png" width= "height=" 34 "/ The user can be granted global permissions, database permissions, table permissions, and column permissions.
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m01/79/86/wkiom1atfx7ixlzeaain1jsnhj8089.png "width=" 1095 "height=" 743 "/>
Objects that can be authorized for access
Grant Database Developer (yangql402), creating permissions for tables, indexes, views, stored procedures, functions, and so on.
Grant creates, modifies, and deletes MySQL data table structure permissions.
Grant create on schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Grant Alteron schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Grant Dropon schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Grant operates MySQL temp table permissions.
Grant create temporary tables on schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Grant operates MySQL index permissions.
Grant Index Onschooldb.*to ' Zhang ' @ ' 192.168.80.% ';
Grant operates the MySQL view, viewing the view source code permissions.
Grant CREATE view on schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Grant ShowView on schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Grant operates MySQL stored procedures, function permissions.
Grant create routine on schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Grant alter routine on Schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Grant Executeon schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Grants permission to execute a specified stored procedure or use a function.
Mysql> Grant execute on procedure schooldb.gets to ' Zhang ' @ ' 192.168.80.% ';
Mysql> Grant execute on function schooldb.create_name to ' Zhang ' @ ' 192.168.80.% ';
This permission is stored in the Procs_priv table in the MySQL database, and the following commands enable you to view the permissions granted.
SELECT * from Procs_priv;
650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m02/79/86/wkiom1atfycx2izeaaasjq74pzq900.png "width=" 794 "height=" "/>"
The following SQL statement cancels the permission to execute the gets stored procedure.
Mysql> revoke execute on procedure schooldb.gets from ' Zhang ' @ ' 192.168.80.% ';
The following SQL statement cancels the permission to use the Create_name function.
Mysql> revoke execute on function schooldb.create_name from ' Zhang ' @ ' 192.168.80.% ';
The following SQL statement authorizes a user at the database level to execute all stored procedures for the database and to use all functions.
Mysql> Grant execute on schooldb.* to ' Zhang ' @ ' 192.168.80.% ';
Restore MySQL Administrator account password
Forget the root password, you can change the configuration file, add a line of "Skip-grant-tables" in the [Mysqld] segment, restart the MySQL service, you can log in to MySQL using the root account blank password.
To reset the MySQL administrator password:
1. Change the configuration of the MySQL service configuration file
[Email protected] ~]# VI/ETC/MY.CNF
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
User=mysql
# Disabling Symbolic-links is recommended to prevent assorted security risks
Symbolic-links=0
Skip-name-resolve
max_connections=200
Skip-grant-tables
2. Save the configuration file
3. Restart the MySQL service
[Email protected] ~]# service mysqld restart
4. connect MySQL with the root account null password
[Email protected] ~]# mysql-u root
mysql> use MySQL;
5. failed to change the root user password in the following way. Because MySQL starts with the skip-grant-tables option, you cannot change the password using this command.
mysql> Set password for [email protected] ' localhost ' =password (' 123 ');
ERROR 1290 (HY000): The MySQL server is running with the--skip-grant-tables option so it cannot execute this statement
6. set the root ' account password by changing the table directly, the following command sets the password of root for all login accounts.
mysql> Update user set Password=password (' 123 ') where user= ' root ';
7. exit MySQL
Mysql> quit
8. Edit the MySQL configuration file and comment out the #skip-grant-tables
[Email protected] ~]# VI/ETC/MY.CNF
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
User=mysql
# Disabling Symbolic-links is recommended to prevent assorted security risks
Symbolic-links=0
Skip-name-resolve
max_connections=200
#skip-grant-tables
9. Save Exit
restart MySQL service
One . Restart MySQL Service
[Email protected] ~]# service mysqld restart
Log in with the new password.
[Email protected] ~]# mysql-u root-p
Enter Password:
This article is from the "Han Li" blog, please be sure to keep this source http://91xueit.blog.51cto.com/400469/1733895
The No. 01 chapter MySQL User and Rights Management v1