MySQL Rights Management

Source: Internet
Author: User

Facebook uses the Gtid

One instance multiple libraries

Show privileges;

To develop an account

Crud

Grant Select,insert,update,delete on dnname.* to ' username ' @ ' 192.168.0.% ';

Help create user;

User name length 8-16 characters

Password 8-20 characters

Create user ' App_dev ' @ '% ' identified by ' A1 ';

Create user ' App_dev ' @ ' 192.168.0.% ' identified by ' A2 ';

Create user ' App_dev ' @ ' 192.168.0.101 ' identified by ' A3 ';

Exact match


Create user ' test ' @ ' 192.168.0.% ' identified by ' 123456 ';


See how many accounts you have

Mysql> select User,host from Mysql.user;

+------------+--------------+

| user | Host |

+------------+--------------+

| ' Test ' | 192.168..0.% |

| Test | 192.168.0.% |

| ' Test ' | 192.168.0.% |

| Mysql.sys | localhost |

| Root | localhost |

+------------+--------------+

5 rows in Set (0.00 sec)


Select User (), current_user ();


Desc information_schema.processlist;

Show Processlist;


Select Host from Information_schema.processlist;

View the machine and the number of connections

Select Host, current_connections from Sys.host_summary;


Select Substring_index (Host, ":", 1), COUNT (*) as Conn from Information_schema.processlist Group by Substring_index (host, ":", 1);


Assumption:There are 20 front-end connections in the DB

Reject a connection

[Email protected] ' 192.168.0.% ';

192.168.0.101 App_dev

Exact match

Create user ' App_dev ' @ ' 192.168.0.101 ' identified by ' AA ';


Select User,host,authentication_string from Mysql.user where user= ' test ';


Delete User

Drop user ' App_dev ' @ ' 192.168.0.101 ' and host= ' 192.168.0.% ';

Flush privileges;


Delete from Mysql.user where user= ' test ' and host= ' 192.168.0.% ';

Flush privileges;


Flush full privileges;


MySQL user name root, password forgot resolution method

Modifying a configuration file

My.cnf

[Mysqld]

Skip-grant-tables


MySQL--defaults-file=/path/my.cnf--skip-grant-tables &


Service mysqld Restart


Set Password



Or

Update Mysql.user set Authentication_string=password (' WUBXWUBX ') where user= ' root ' and host= ' localhost ';


#小心执行

Flush tables;

Flush logs


#kill-hup 8462 test environment


Cat/etc/init.d/mysql | grep kill



What's wrong with MySQL schema?

Represents a library in db








This article is from the "Liang blog" blog, make sure to keep this source http://7038006.blog.51cto.com/7028006/1893623

MySQL Rights Management

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.