MySQL User Login and Operation execution

Source: Internet
Author: User

A user can not log into the MySQL database, determined by two factors

1, who you are: that is, the MySQL database records the user name and password, in the SQL Server database, only asked to explain who you can log in, but MySQL is not the case it depends on the second

2, Born: You are the Capital Palace in the Zhang San, or Ravine ditch Zhang San, in MySQL it seems you are two different people.

MySQL records this important information in the Mysql.user table (User,password) and who you Are (Host)--where you are (birthplace)

  

Discover that there are 4 of them without root alone.

--------------------------------------------------------------------------------------------------------------- ----------

Our ultimate goal is not just to connect to the MySQL database, but also to manipulate the data inside. Face to operate we must first get the appropriate permission! The permissions of the user are recorded in the following tables

1 Mysql.user It records the user's global permissions This is also the maximum granularity of permissions, so that said also do not understand, or an example

The root user's select_priv is y to indicate that it can query any object in MySQL database. Such a powerful privilege if I just want to control the user's permissions in a certain database!

This granularity of permission corresponds to the Mysql.db table.

2 mysql.db It records which user has permissions on which database, or the same old example

See no user column no record root users Oh! So the question is, can you query the tables in any database for the root of the hairs? This is because the record is again in the Mysql.user table, in the Mysql.user table

Select_priv = Y is for all databases, that is, when root run a query, first go to look at mysql.user see if there is no permission to run this query, if there is to execute, if not go to the Mysq.db table to see if you have this permission. See the granularity of the lack of permission every small level will be more than once judged! This can affect performance.

3 Mysql.tables_priv said so much I think this will not have to say, look at the name to know that it is a table-level control.

4 granularity control of Mysql.columns_priv column levels

5 Mysql.proc_priv granularity control of stored procedures and function levels

MySQL User Login and Operation execution

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.