Change the password for MySQL under Mac

Source: Internet
Author: User
Tags flush mysql version

First KindMySQL version: 5.7.171. First we want to shut down the MySQL service sudo/usr/local/mysql/support-files/mysql.server Stop2. We're going to start with Safe mode mysqlsudo/usr/ Local/mysql/bin/mysqld_safe--skip-grant-tables3. Log in to the MySQL service using the root account/usr/local/mysql/bin/mysql u Root4. Modify the root account password (this is actually the SQL statement) Update mysql.user set Authentication_string=password (' Qingyun1 ') where user= ' root ' and Host = ' localhost '; if necessary, it is recommended to run: Flush privileges;5. Shutdown Safe Mode, normal restart mysqlsudo/usr/local/mysql/support-files/ Mysql.server restart6. Normal use of root account and password connection Mysql/usr/local/mysql/bin/mysql-u root-p the second kind
If you forget the password, forcibly modified: 1:? Stop MySQL service sudo/usr/local/mysql/support-files/mysql.server stop2:? Enter terminal input: cd/usr/local/mysql/bin/? After carriage return; login administrator permissions sudo su? Enter the following command to disable the MySQL authentication feature./mysqld_safe--skip-grant-tables &? MySQL will restart automatically after carriage return (the MySQL status in the preferences will become running) 3. ?  Enter the command./mysql. Enter command FLUSH privileges after carriage return; After entering, enter the command ALTER USER ' root ' @ ' localhost ' identified by ' your new password ';
1. Stop MySQL server.  Usually is in ' System Preferences ' > MySQL > ' Stop mysql Server ' or: Sudo/usr/local/mysql/support-files/mysql.server stop2.  Open Terminal, enter: Sudo/usr/local/mysql/bin/mysqld_safe--skip-grant-tables3. Open another new terminal, enter: Sudo/usr/local/mysql/bin/mysql-u root UPDATE mysql.user SET authentication_string=password (' New password ') WH     ERE user= ' root ';     FLUSH privileges;  \q4. Restart Sudo/usr/local/mysql/support-files/mysql.server restart* above methods for MySQLV5.7.9, old version of MySQL please use: UPDATE mysql.user SET password=password (' New password ') WHERE user= ' root '; these three ways can be used according to the situation!

Change the password for MySQL under Mac

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.