MySQL forgets the password and then resets the password (Mac). mysql forgets the password.

Source: Internet
Author: User

MySQL forgets the password and then resets the password (Mac). mysql forgets the password.

After MySQL is installed, the system gives a default password and says that if you forget the default password ...... I copied the default password and took only one step. This step is the beginning of my long journey. The password he gave was too complicated. Of course I had to change one, and I had to pretend that I didn't remember the password, so I couldn't go back ......

This process is sad. There are many documents on the Internet, such as dogs. The key is that there are different ways of error. After trying for half a day, there is no such thing, and the psychological defense will be broken soon, when I go to the MySQL document, I have successfully changed it. No article tells me the complete answer. I have referenced several strategies and closed-doors cars. Like yourself. Let's talk a little bit about it. Let's go with me step by step.

  1. Disable mysql Server
    Sudo/usr/local/mysql/support-files/mysql. server stop
    You can also disable MySQL in the system preference.
  2. Cd/usr/local/mysql/bin to enter the Directory
  3. Sudo su
  4. ./Mysqld_safe -- skip-grant-tables & restart the server
  5. Reopen a terminal,

Configure short commands:

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

  1. Enter mysql to enter mysql command mode
  2. Use mysql to enter the mysql database
  3. Flush privileges; it is probably to get the permission, or he won't let you change it.
  4. Set password for 'root' @ 'localhost' = password ('new password'); Complete Modification
  5. I finally finished the change.

 

If you know the password:

Mysqladmin-u root-p password new password ...........

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.