MySql user permission Control

Source: Internet
Author: User

MySql USER permission control this article describes how to CREATE and delete accounts in MySql, and how to set and introduce permissions of various accounts to create user accounts: www.2cto.com [SQL] CREATE USER user_name IDENTIFIED BY 'your _ password '; RENAME [SQL] rename user old_name TO new_name; delete USER account [SQL] DROP USER user_name; view USER permissions by using www.2cto.com SHOW GRANTS FOR user_name; If displayed: grant usage on *. * TO 'user _ name' @ '%' indicates no permission !!!! The previous "*" indicates any database, and the other "indicates any tables in the database. Note: You must have the grant option permission before using GRANT and INVOKE to GRANT or revoke permissions to other users. Example: grant select permission grant select on testdb. * TO user_name; grant the SELECT permission TO all tables in the testdb database TO the user_name user. REVOKE permission: revoke select on testdb. * FROM user_name; revoke the SELECT permission on all tables in the testdb database. you can write multiple statements at a time, such as grant select and insert on testdb. * TO user_name; MySql permissions are shown in the following table: ALL permissions except grant option alter routing alter procedure and DROP P ROCEDURECREATE use create tablecreate routing use create procedurecreate temporary tables use create temporary tablecreate user use create user, drop user, rename user and revoke all privilleagescreate view use create viewdelete use DELETEDROP use drop tableexecute use CALL and stored Procedure FILE use select into outfile and load data infilegrant option use GRANT and REVOKEINDEX use create index and drop indexinsert use insertlock tables use LOCK TABLESPR OCESS uses show full processlistreload to access replication slave from the location of the fflushreplication client server by the replication slave use SELECT use selectshow databases use show databasesshow view use show create viewshutdown use mysqladmin shutdown (used to close MySQL) SUPER uses change master, KILL, LOGS, PURGE, MASTER, and set global. You can also allow mysqladmin to debug and log on to UPDATE using UPDATEUSAGE without access permission [SQL] to change the PASSWORD SET PASSWORD FOR user_name = password ('new _ password '); or set password = PASSWORD ('new _ password'); this is to change your password GRANT and REVOKE. You can control the access permission at several levels: the entire server, use grant all and revoke all; the entire database uses ON database. *; for specific tables, use ON database. table; specific columns, do not know specific stored procedures, do not know to add a point, when we directly enter mysql in the linux system, will log in with a local anonymous account, that is, ''@ localhost, and this account has no permissions at the beginning, that is, USAGE *. *. In most cases, the operation fails. In this case, if we only want to learn, we can first log on to mysql-u root-p <CR> using root, and then enter the root password (or if there is no password,-p is not added) grant all on *. * FOR ''@ localhost.

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.