Initializing the MySQL root password in a MAC environment

Source: Internet
Author: User

1. Turn off the MySQL service, turn on the system setup last MySQL, then turn off MySQL first

2. Generate a file named Mysql-init, put in the file: a sentence, this sentence different version, the following: (not included in parentheses)

Alter user ' root ' @ ' localhost ' identified by ' new password '; (MySQL 5.7.6 and later)

Set password for ' root ' @ ' localhost ' =password (' new password ');(MySQL 5.7.5 and earlier)

3.cd/usr/local/mysql/bin/

sudo su

Mysql_safe-init-file=/home/me/mysql-init &

Mysql_safe-skip-grant-tables &

./mysql

Flush privileges;

Update mysql.user Set authentication_string = password (' The new password you defined in the file '), password_expired = ' N ' where user = ' root ' and host = ' localhost ';

Flush privileges;

Quit

./mysql-u Root-p

Just type in your new password.

Reference: http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

b.5.3.2.2 resetting the Root Password:unix and Unix-like Systems Section

Initializing the MySQL root password in a MAC environment

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.