The method of resetting the password after the Mysql password is forgotten under the Mac operating system _mysql

Source: Internet
Author: User
Tags flush

After installing MySQL, the system gives a default password and then says if you forget the default password ... I copied the default password and took one step, which was the beginning of my long journey. His password is too complicated, of course, I have to change, and I will pretend that I do not remember the password, so I walked on the road of no return ...

This process is sad, online information, such as dogs, the key is each have their own wrong method, tried for a long time did not have a right, in the impending break psychological defense, to go over the MySQL document, I changed the success. No article told me the complete answer, I was referring to several raiders, behind closed doors built cars. Give yourself some praise. Don't say much nonsense, step by step with me.

Shutdown MySQL Server

Sudo/usr/local/mysql/support-files/mysql.server stop
You can also have a MySQL shutdown in your system preferences.
Cd/usr/local/mysql/bin Access Directory
sudo su Get Permissions
./mysqld_safe--skip-grant-tables & Restart Server
To open a terminal,

To configure a short command:

Alias Mysql=/usr/local/mysql/bin/mysql

Enter MySQL into MySQL command mode
Use MySQL to enter the MySQL database
Flush privileges is probably to get permission, or he won't let you change.
Set password for ' root ' @ ' localhost ' =password (' new password '); Complete the Modification

I'm finally done.

If you know the password:

mysqladmin-u root-p password New password .....

The above is a small set to introduce the Mac forgot MySQL password after the method of resetting the password, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Ps:mac operating system under the MySQL database password forgotten fast solution

1. In the system preferences, the termination of the MySQL service.

2. Cd/usr/local/mysql-...../bin

sudo./mysqld_safe--skip-grant-tables

3. Login to MySQL;

Mysql

4. The password of the empty root user;

mysql> Update mysql.user set password= ' whereuser= ' root;
mysql> flush Privileges;
Mysql> quit

5. Restart the MySQL service,

6. Add password mysql> mysqladmin-u root-p password 123 password to 123

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.