Mysql user authorization

Source: Internet
Author: User

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"
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.