MySQL Account and Rights management

Source: Internet
Author: User
Tags pkill

#0 Change the root password

Mysqladmin-u root-p Password yeqing

#1 Delete Unused accounts

Select User,hostfrom mysql.user;

Delete from Mysql.user where user! = ' root ';

Delete from mysql.user where user = ' root ' and host= ' 127.0.0.1 ';

Flush privileges;

#2 Delete root account by mistake?

/etc/init.d/mysqld Stop or Pkill mysqld

Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &

Mysql

UPDATE mysql.user SET password=password (' yeqing '), host= ' localhost ' where user= ' root ';

Flush privileges;

Pkill mysqld

Pkill mysqld

Mysql-u root-p

Yeqing Enter

#3 first create account re-authorization (method one)

Create [email protected] ' localhost ' identified by ' 123456 ';

Grant all ondb1.* to [email protected] ' localhost ';

Or

Grant Select,insert,update,delete, create,dropon db1.* to ' yeqing ' @ ' 192.168.1.% ' identified by ' test123 '

Flushprivileges;

Show grants [email protected] ' localhost ';

#4 simultaneous authorization to create an account (method two)

Grant all onmysql.* to [email protected] ' localhost ' identified by ' 123456 ';

Grant all on * * to [e-mail protected] ' 192.168.1.% ' identified by ' test123 '

Flushprivileges;



MySQL Account and Rights management

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.