Different permissions have different operations on the MySQL database. The following describes some knowledge about MySQL permission management. If you are interested in MySQL permission management, take a look.
========= Change the user password for the ROOT user password operation) =========
After the MySQL has just been installed, there is only one root user in MySQL permission management. The password is blank and can only be logged on to the local machine!
Add the password xxx123 to the root user:
./Bin/mysqladmin-u root password xxx123
Or write
./Bin/mysqladmin-uroot password xxx123
After the password is added, enter mysql in this tutorial:
./Bin/mysql-uroot-p
Change the root password from xxx123 to yy1234:
./Bin/mysqladmin-uroot-pxxx123 password yy1234
======= Grant permissions on database objects to users ==============
The simple format of commands granted to users by MySQL is as follows:
Grant permission on database objects to users
Grant permission on database object to user identified by "password"
======= User and permission management: The most common operation instance ==========
(Username: dba1, password: dbapasswd, logon IP: 192.168.0.10)
// Open the permission to manage all databases in MySQL
Grant all on *. * to dba1 @ '192. 168.0.10 'identified by "dbapasswd ";
// Open the permission to manage the specific database testdb in MySQL.
Grant all privileges on testdb to dba1 @ '192. 168.0.10 'identified by "dbapasswd ";
Or
Grant all on testdb to dba1 @ '192. 168.0.10 'identified by "dbapasswd ";
// Open the permission to manage tables (testdb. table1) of a specific MySQL database
Grant all on testdb. teable1 to dba1 @ '192. 168.0.10 'identified by "dbapasswd ";
// Open the permission to manage some columns of a table (testdb. table1) of a specific database in MySQL
Grant select (id, se, rank) on testdb. table1 to ba1 @ '192. 168.0.10 'identified by "dbapasswd ";
// Open management operation commands
Grant select, insert, update, delete on testdb. * to dba1 @ '192. 168.0.10 'identified by "dbapasswd ";
// Revoke permissions
Revoke all on *. * from dba1 @ localhost;
// View MySQL user permissions
Show grants;
Show grants for dba1 @ localhost;
The preceding section describes MySQL permission management.
How to optimize mysql Indexes
Mysql index Comparison Analysis
MySQL index usage
Insufficient mysql Indexes
MySql connection string description