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

Pure JavaScript to implement the number guessing game

Develop a number guessing game that randomly sele...

Docker volume deletion operation

prune To use this command, both the client and da...

Steps to solve the MySQL 8.0 time zone problem

Software Version Windows: Windows 10 MySQL: mysql...

The main differences between MySQL 4.1/5.0/5.1/5.5/5.6

Some command differences between versions: show i...

User-centered design

I've been asked a lot lately about an apparen...

Detailed explanation of encoding issues during MySQL command line operations

1. Check the MySQL database encoding mysql -u use...

Embed player in web page embed element autostart false invalid

Recently, I encountered the need to embed a player...

MySQL daily statistics report fills in 0 if there is no data on that day

1. Problem reproduction: Count the total number o...

20 JS abbreviation skills to improve work efficiency

Table of contents When declaring multiple variabl...

A brief discussion on HTML table tags

Mainly discuss its structure and some important pr...

Why Seconds_Behind_Master is still 0 when MySQL synchronization delay occurs

Table of contents Problem Description Principle A...

Introduction to JavaScript Number and Math Objects

Table of contents 1. Number in JavaScript 2. Math...

Introduction to Docker containers

Docker Overview Docker is an open source software...