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

Solution to EF (Entity Framework) inserting or updating data errors

Error message: Store update, insert, or delete st...

Why Seconds_Behind_Master is still 0 when MySQL synchronization delay occurs

Table of contents Problem Description Principle A...

A brief analysis of MySQL parallel replication

01 The concept of parallel replication In the mas...

How to directly reference vue and element-ui in html

The code looks like this: <!DOCTYPE html> &...

Why do code standards require SQL statements not to have too many joins?

Free points Interviewer : Have you ever used Linu...

Example verification MySQL | update field with the same value will record binlog

1. Introduction A few days ago, a development col...

Web page creation for beginners: Learn to use HTML's hyperlink A tag

The hyperlink a tag represents a link point and i...

The process of building lamp architecture through docker container

Table of contents 1. Pull the centos image 2. Bui...

Quickly get started with VUE 3 teleport components and usage syntax

Table of contents 1. Introduction to teleport 1.1...

MySQL uses custom sequences to implement row_number functions (detailed steps)

After reading some articles, I finally figured ou...

Ubuntu 20.04 turns on hidden recording noise reduction function (recommended)

Recently, when using kazam in Ubuntu 20.04 for re...

React gets input value and submits 2 methods examples

Method 1: Use the target event attribute of the E...

Circular progress bar implemented with CSS

Achieve results Implementation Code html <div ...