MySQL command line User Creation and authorization

Source: Internet
Author: User
Tags mysql command line
Environment: MySQLSever5.1MySQL command line tool problem: use command line to create a user and authorize 1. create a user: Command: CREATEUSERusernameIDENTIFIEDBYpassword; Description: username -- the user name you will create, password -- the user's login password. The password can be blank.

Environment: MySQL Sever 5.1 MySQL command line tool problem: use command line to create a user and authorize 1. create user: Command: create user username identified by 'Password'; Description: username -- the username you will CREATE, password -- the USER's login password. The password can be blank, if it is null, the user can

Environment: MySQL Sever 5.1 + MySQL command line tool


Problem: Use command lines to create and authorize users

1. Create a user:

Command:Create user username identified by 'Password ';

Description: username -- the username you will create, password -- the login password of the user. The password can be blank. If it is blank, the user can log on to the server without a password.

Example:


CREATE USER wgb IDENTIFIED BY ‘wgb’;


2. Authorization:

Command:GRANT privileges ON databasename. tablename TO username;

Note: privileges-user operation permissions, such as SELECT, INSERT, and UPDATE. If you want to grant ALL permissions, 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,UPDATE ON test.user TO wgv;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 ONdatabasename. tablename to with grant option;

After authorization, you must refresh the system permission table:


flush privileges;


References:


MySQL user creation and authorization


MySql creates a user, creates a database, authorizes a user, deletes a user, and modifies a password.


How to create a user and a database in MySql

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.