MySQL command used to change the root password

Source: Internet
Author: User

The following articles mainly describe the actual application commands for MySQL to change the root password. We all know that there are still many commands for MySQL to change the root password in actual application, the following articles mainly describe the actual application commands, and I hope you will gain some benefits.

MySQL command to change the root password:

Run the MySQL command to change the root password. Switch to the MySQL installation directory under cmd.

Example

 
 
  1. d:/MySQL/bin  

Prerequisites: the MySQL root Password is empty.

Enter MySQL-u root MySQL

 
 
  1. MySQL> enter update user set passwordpassword = password ('new password') where user = 'root ';

Echo

 
 
  1. Query OK, 0 rows affected (0.00 sec)
  2. Rows matched: 2 Changed: 0 Warnings: 0
  3. MySQL> Status, enter flush privileges;

Echo

 
 
  1. Query OK, 0 rows affected (0.00 sec)
  2. MySQL> enter quit

Exit SQL

Note that a semicolon ";" must be added after each command ";"

MySQL started to execute this command

The second command updates the database of the MySQL system that has been loaded into the memory.

Restart MySQL.

After the root password is updated, the method for connecting to MySQL is as follows:

New MySQL-uroot-p password. The above content is an introduction to the MySQL Command for modifying the root password. I hope you will get some benefits.

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.