Newly installed MySQL under Mac cannot log on to root user solution

Source: Internet
Author: User

A set MySQL command line search path 0. The bottom point of the system Preferences, Apple, MySQL start MySQL service on the pop-up page 1. Open terminal, input: sudo vi ~/.bash_profile if already deleted: sudo rm-rf. bash_* 2. Input i 3. Then stick Paste the following content # Mysqlalias mysql= '/usr/local/mysql/bin/mysql ' Alias mysqladmin= '/usr/local/mysql/bin/mysqladmin ' # Lsalias ls= ' Ls-g ' 4. Press ESC 5. Enter: Wq6. Restart Terminal program two MAC new installed MySQL cannot log on to root user workaround

When MySQL is installed on the MacBook Pro, an error occurs when you execute mysqladmin to set the password for the root account.

Mysqladmin:connect to server at ' localhost ' failed

Error: ' Access denied for user ' root ' @ ' localhost ' (using Password:no) '

1: The bottom point of apple---system preferences, MySQL turn off MySQL service in the pop-up page

2: Enter terminal
Input: Cd/usr/local/mysql/bin

3. Login administrator rights after enter
sudo su
4. Enter the following command to disable the MySQL authentication function after carriage return
./mysqld_safe--skip-grant-tables &

--skip-grant-tables: Do not start grant-tables (authorization table), skip permission control.

--skip-networking: Skipping the TCP/IP protocol, only native access (this option is not required.) Can not be used)

5. Change Password:

mysql> Update Mysql.user Set Authentication_string=password (' 123456 ') where user= ' root ';

mysql> flush Privileges;

Newly installed MySQL under Mac cannot log on to root user solution

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.