Solve the problem of being unable to log in when installing MySQL on mac using homebrew

Solve the problem of being unable to log in when installing MySQL on mac using homebrew

If your computer is a Mac, using homebrew to install MySQL is a very convenient way, but there are still some problems;

First, make sure you have installed MySQL. If you installed it via homebrew, type mysql.server start to start the service.

If you enter

mysql -u root

This error ERROR 1045 (28000): Access denied for user 'zhongchengming'@'localhost' (using password: YES) appears. It should be that the initial password was not successfully changed.

Solution steps

(1) Enter mysqld_safe --skip-grant-tables in the terminal and the following is displayed:

2017-03-21T11:44:11.6NZ mysqld_safe Logging to '/usr/local/var/mysql/zhongchengmingdeMacBook-Air.local.err'.
2017-03-21T11:44:11.6NZ mysqld_safe Logging to '/usr/local/var/mysql/zhongchengmingdeMacBook-Air.local.err'.
2017-03-21T11:44:11.6NZ mysqld_safe A mysqld process already exists

(2) Enter mysql -u root again and the following is displayed

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.17 Homebrew
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

(3) Enter use mysql in the terminal and the following is displayed

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>

(4) Change password UPDATE mysql.user SET authentication_string=PASSWORD('你的密碼') WHERE User='root';

Success Query OK, 1 row affected, 1 warning (0.05 sec)

Rows matched: 1 Changed: 1 Warnings: 1

The above is what I introduced to you about solving the problem of not being able to log in when installing MySQL on Mac using homebrew. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • MySQL 5.7.12 installation and configuration tutorial under Mac OS 10.11
  • MySQL 5.7.13 Installation and Configuration Notes (Mac OS)
  • MySQL installation and configuration method graphic tutorial under MAC
  • How to install and uninstall MySQL 5.7.11 on Mac
  • How to install the latest 5.7.9mysql on mac OS X10.10
  • Sharing the process of installing MySQL on Mac
  • Install MYSQL on MAC OS X

<<:  Configure VIM as a C++ development editor in Ubuntu

>>:  How to use JSX in Vue

Recommend

The forgotten button tag

Note: This article has been translated by someone ...

How to query a record in Mysql in which page of paging

Preface In practice, we may encounter such a prob...

Sharing some wonderful uses of wxs files in WeChat applet

Table of contents Preface application Filters Dra...

Example of adding music video to HTML page

1. Video tag Supports automatic playback in Firef...

The difference between shtml and html

Shtml and asp are similar. In files named shtml, s...

WeChat applet calculator example

This article shares the specific code of the WeCh...

Summary of common commands for Ubuntu servers

Most of the commands below need to be entered in ...

Implementation of a simple login page for WeChat applet (with source code)

Table of contents 1. Picture above 2. User does n...

Summary of various implementation methods of mysql database backup

This article describes various ways to implement ...

Prevent HTML and JSP pages from being cached and re-fetched from the web server

After the user logs out, if the back button on the...

Detailed explanation of the use of filter properties in CSS

The filter attribute defines the visual effect of...