Mac install MySQL set initial password

Source: Internet
Author: User

After installing MySQL on a Mac, log on to the local data connection via navigate and find no password, and no password was set during the installation of MySQL. In fact, just installed, there is an interface, assigned an initialization of the password, maybe everyone like me, directly click on the jump past, have not saved, so it is necessary to just install the MySQL reset new password;

Directly on the solution, the command line is used directly as a:

One, the first step: Stop the MySQL service.

To turn off the operation of the MySQL service:
The bottom point of the system Preferences, Apple-, MySQL close MySQL service on the popup page (click stop mysql server )

Second, step two: Enter the terminal, instructions to restart the MySQL service.

0. Open the terminal:

1. Enter: cd /usr/local/mysql/bin/
2. Enter: sudo ./mysqld_safe --skip-grant-tables
    
3, enter the command 2, will prompt for password: (Mac account root user password)

4, then you will find that MySQL will automatically restart

Step three: Open a different terminal, set up the MySQL password.

1. Enter:cd /usr/local/mysql/bin/

2. Enter: ./mysql

3. Input:mysql> FLUSH PRIVILEGES;

4. Set the password admin123
Input:mysql> SET PASSWORD FOR ‘root‘@‘localhost‘ = PASSWORD(‘admin123‘);

That's all. Thank

Mac install MySQL set initial 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.