Mysql user new, authorize, delete, password modify _mysql at win command prompt

Source: Internet
Author: User
Tags flush
First of all to declare: Under normal circumstances, to modify the MySQL password, authorization, is required to have the root of MySQL permissions.
Note: This operation is at the win command prompt, phpMyAdmin is also applicable.
User: Phplamp user database: phplampdb

1. New User

Login to MySQL
@>mysql-u root-p
@> Password
Create a user
mysql> INSERT INTO Mysql.user (Host,user,password) VALUES ("localhost", "Phplamp", Password ("1234"));
Refresh System Permission Table
Mysql>flush privileges;
This creates a user named: phplamp Password: 1234.
Then log in.
mysql>exit;
@>mysql-u phplamp-p
@> Enter password
Mysql> Login Successful

2. Authorize the user

If you want to allow the user to connect to the MySQL server from the IP-192.168.1.6 host, and use MyPassword as the password myuser

Grantall privileges on *.* to ' myuser ' @ ' 192.168.1.3 ' identified by ' MyPassword ' withgrant OPTION;

FLUSH privileges;

3. Delete User

@>mysql-u root-p
@> Password
Mysql>delete from user WHERE user= "phplamp" and host= "localhost";
Mysql>flush privileges;
Delete a user's database
Mysql>drop database phplampdb;

4. Modify the specified user password

@>mysql-u root-p
@> Password
Mysql>update Mysql.user Set Password=password (' New password ') where user= "Phplamp" and host= "localhost";
Mysql>flush privileges;
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.