First, declare that, in general, you need to have the root permission in MySQL to modify the mysql password and grant permissions. User: linuxidc user database: linuxidc. com1.
First, declare that, in general, you need to have the root permission in MySQL to modify the mysql password and grant permissions. User: linuxidc user database: linuxidc. com1.
First, declare: Generally, you need to have the root permission in MySQL to modify the mysql password and grant permissions.
User: linuxidc user database: linuxidc.com
1. Create a user.
// Log on to MYSQL
@> Mysql-u root-p
@> Password
// Create a user
Mysql> insert into mysql. user (Host, User, Password) values ("localhost", "linuxidc", password ("123456 "));
// Refresh the system permission list
Mysql> flush privileges;
In this way, a user named linuxidc password 123456 is created.
Then log on.
Mysql> exit;
@> Mysql-u linuxidc-p
@> Enter the password
Mysql> logon successful
2. Authorize the user.
// Log on to MYSQL (with ROOT permission ). I log on as ROOT.
@> Mysql-u root-p
@> Password
// First create a database for the user (linuxidc.com)
Mysql> create database linuxidc.com;
// Authorize the linuxidc user to have all permissions for the linuxidc.com database.
> Grant all privileges on linuxidc.com. * to linuxidc @ "%" identified by '123 ';
// Refresh the system permission list
Mysql> flush privileges;
Mysql> other operations
/*
If you want to assign some permissions to a user, you can write as follows:
Mysql> grant select, update on linuxidc.com. * to linuxidc @ "%" identified by '123 ';
// Refresh the system permission table.
Mysql> flush privileges;
*/
3. delete a user.
@> Mysql-u root-p
@> Password
Mysql> delete from user WHERE User = "linuxidc" and Host = "localhost ";
Mysql> flush privileges;
// Delete the user's database
Mysql> drop database linuxidc.com;
4. change the password of a specified user.
@> Mysql-u root-p
@> Password
Mysql> update mysql. user set password = password ('new password') where User = "linuxidc" and Host = "% ";
Mysql> flush privileges;