MYSQL Add user and change password, including root

Source: Internet
Author: User

1. Select Data Sheet

The statements are as follows: UseMySQL;

2. Add a connection user account to the users table in MySQL:

Instead of adding a user record directly using the INSERT statement, using Insert may appear:

Error 1364 (HY000): Field ' ssl_cipher ' doesn ' t has a default value error. However, the early MySQL version of the author did not appear this error, because the day edge has been directly modified user table or directly using the INSERT statement, and later upgrade MySQL to 5.1, found that this error may occur.

The GRANT statement is recommended for authorization with the following statement:

GRANT USAGE on *. username ' @ ' localhost ' identified by ' password ' with GRANT OPTION;

The sentence:

"username" is replaced with the username that will be authorized, such as CLIENTUSR;

"Password" is replaced with the password set by CLIENTUSR;

3. Access to Data sheet authorization

After the account has been created, the data table authorization is given to the common user above, and the connection user default permissions added in step 3 are "N", the account must be authorized in the DB table to access the dedicated database , and of course the superuser does not say.

Use the following statement:

GRANT Select,insert,update,delete,create,drop on tablename.* to ' username ' @ ' localhost ' identified by ' password ';

The permissions in this statement are determined according to actual needs:

"TableName" replaced with the table name of the data tables authorized for access

"Username" is the Step 2 authorized user name

"Password" is the setup password for step 2 authorized users

This gives the user a select, INSERT, UPDATE, DELETE, Careate, and drop permissions on a data table.

4, the effective authorization, the creation is complete

A word can: FLUSH privileges;


This article is from "This is My Freedom" blog, please be sure to keep this source http://sasyun.blog.51cto.com/8709212/1530827

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.