MySQL Account management

Source: Internet
Author: User
Tags sql error

One user to add

    1. Add a user by using the Insert method

Insert into Mysql.user (Host,user,password) VALUES ("localhost", "sa", Password ("admin123"))

An exception occurred:

Dbcexception:sql Error [1364] [HY000]: Field ' ssl_cipher ' doesn ' t has a default value

Java.sql.SQLException:SQLException:Field ' ssl_cipher ' doesn ' t have a default value

Exception reason : prohibit the user users from being modified by the insert method

Workaround: There is a statementin my.cnf : Sql_mode=no_engine_substitution,strict_trans_tables.

will be changed to: Sql_mode=no_engine_substitution.

Restart the server.

    1. Create by command

CREATE USER ' sa ' @ ' 127.0.0.1 ' identified by "admin123";

192.168.189.%:ip can restrict a user's IP by using wildcards

Two . User Delete

DELETE from user WHERE user= "sa" and host= "localhost";
Flush privileges;

Three . Change Password

Update Mysql.user set Password=password (' new password ') where
User= "sa" and host= "localhost";
Flush privileges;

Iv. . User Authorization

Create Database Cplusplusdb;
authorizes the cplusplus user to have All the permissions of the CPLUSPLUSDB database.
Grant all privileges the cplusplusdb.* to [email protected] identified
By ' admin123 ';
Refresh System Permissions Table
Mysql>flush privileges;

Five . Partial Authorization

Grant Select,update on cplusplusdb.* to [email protected]
Identified by ' admin123 ';
refreshes the System permissions table.
Flush privileges;

MySQL Account management

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.