Mysql user authorization
By default, mysql enters and operates as the root user, to access the database as another user and add, delete, modify, and query the database, you must enter the database as the root user and authorize the database to the corresponding user.
Server0:/usr/local/mysql/bin # mysql-uroot-p
Enter password:
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Solrclient |
| Test |
+ -------------------- +
Mysql> grant all privileges on solrclient. * to suse @ localhost identified by 'suse ';
Query OK, 0 rows affected (0.00 sec)
Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Mysql> \ q
You can also perform fine-grained authorization:
// If you want to assign some permissions to a user, you can write as follows:
Mysql> grant select, update on solrDB. * to suse @ localhost identified by 'suse ';
3. delete a user
@> Mysql-u root-p
@> Password
Mysql> delete from user WHERE User = 'suse' and Host = "localhost ";
Mysql> flush privileges;
// Delete the user's database
Mysql> drop database solrDB;
4. change the password of a specified user
@> Mysql-u root-p
@> Password
Mysql> update mysql. user set password = password ('new password') where User = 'suse' and Host = "localhost ";
Mysql> flush privileges;
Mysql> quit;
Author: "715356603-qq-com"