MySQL User creation and authorization _ MySQL-mysql tutorial

Source: Internet
Author: User
Create a user in MySQL and authorize bitsCN.com
Note: my runtime environment is widnows xp professional + MySQL5.0 1. CREATE a USER: Command: create user 'identified BY 'password'; description: username-the username you will CREATE, host-specifies the host on which the user can log on. if a local user can use localhost, if you want the user to log on from any remote host, you can use the wildcard %. password-the user's login password. The password can be blank. if it is blank, the user can log on to the server without the password. example: create user 'identified BY '20160301'; create user _ 'idendified BY '20160301'; create user 'identified BY '20160301'; create user identified by ''; create user; 2. authorization: Command: GRANT privileges ON databasename. tablename TO description: privileges-Operation permissions of a user, such as SELECT, INSERT, and UPDATE (for details, see the last part of this document ). use ALL .; databasename-database name, tablename-table name. if you want to grant the user the corresponding operation permissions on all databases and tables, it can be represented by *, as shown in *. *. example: grant select, insert on test. user TO; grant all on *. * TO; note: The user authorized with the preceding command cannot authorize other users. TO authorize the user, run the following command: GRANT privileges ON databasename. tablename to with grant option; 3. set password for = PASSWORD ('newpassword'); set password = PASSWORD ("newpassword") FOR the current login user; example: set password for = PASSWORD ("123456"); 4. command: REVOKE privilege ON databasename. tablename FROM; description: privilege, databasename, tablename-same authorization section. example: revoke select on *. * FROM; note: If this is the case when you authorize a user (or similar): grant select on test. user TO, then use revoke select on *. * FROM; the command cannot revoke the user's SELECT operation on the user table in the test database. conversely, grant select on * is used for authorization *. * TO; then revoke select on test. the user FROM command cannot revoke the user's Select permission on the user table in the test database. FOR more information, run show grants. 5. command to delete a USER: drop user; Appendix: permission to operate in MySQL ALTERAllows use of alter table. ALTER ROUTINEAlters or drops stored routines. CREATE Allows use of create table. CREATE ROUTINECreates stored routines. create temporary TABLEAllows use of create temporary table. CREATE USERAllows use of create user, drop user, rename user, and revoke all privileges. CREATE VIEWAllows use of create view. DELETEAllows use of DELETE. DROP Allows use of drop table. EXECUTEAllows the user to run stored routines. FILEAllows use of SELECT... into outfile and load data infile. INDEXAllows use of create index and drop index. INSERT Allows use of INSERT. LOCK TABLESAllows use of lock tables on tables for which the user also has SELECT privileges. PROCESSAllows use of show full processlist. RELOADAllows use of FLUSH. REPLICATION Allows the user to ask where slave or masterCLIENTservers are. REPLICATION SLAVENeeded for replication slaves. SELECTAllows use of SELECT. SHOW DATABASESAllows use of show databases. SHOW VIEWAllows use of show create view. SHUTDOWN Allows use of mysqladmin shutdown. SUPERAllows use of change master, KILL, purge master logs, and set global SQL statements. allows mysqladmin debug command. allows one extra connection to be made if maximum connections are reached. UPDATEAllows use of UPDATE. USAGEAllows connection without any specific privileges.bitsCN.com

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.