How to change the root password of Mysql5.7.10 on MAC

How to change the root password of Mysql5.7.10 on MAC

First, start MySQL in skip-grant-tables mode: mysqld --skip-grant-tables &

From now on, you will step into the first pit, if you use the wrong modification method posted everywhere on the Internet:

mysql> UPDATE mysql.user SET authentication_string=PASSWORD('your_new_password') WHERE User='root';

(Note that after 5.7, password is changed to authentication_string) Congratulations, you have successfully modified it, but you will find that when you use a GUI tool such as navicat to connect, the following error will be reported:

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

At the same time, you will find that the command line can use mysql -u root -p to log in, but you can't use mysql, and you can't even use the database. What the hell?

The following command will save you:

mysql> SET PASSWORD = PASSWORD('your_new_password');

After execution, shut down mysqld using the command mysqladmin -u root -p shutdown

Start mysql again with mysql.server start and everything will be ok~

The above is the method I introduced to you to change the root password of Mysql5.7.10 version under MAC. 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:
  • Solution for forgetting the root password of MySQL5.7 under Windows 8.1
  • Detailed tutorial on how to modify the root password after forgetting it in MySQL 5.7
  • What to do if you forget the root password of Mysql5.7 (simple and effective method)
  • Solution to forgetting the root password of MySQL5.7 on Mac
  • MySQL 5.7 installation process and method to reset the root password (shell script)
  • Detailed method for forgetting the root password or resetting the password in Mysql 5.7
  • Problem of retrieving root password in MYSQL 5.7 under Linux (tested and available)

<<:  Detailed explanation of vite+ts to quickly build vue3 projects and introduce related features

>>:  Detailed explanation of mktemp, a basic Linux command

Recommend

How to install ZSH terminal in CentOS 7.x

1. Install basic components First, execute the yu...

Code analysis of synchronous and asynchronous setState issues in React

React originated as an internal project at Facebo...

Copy fields between different tables in MySQL

Sometimes, we need to copy a whole column of data...

Comparing Node.js and Deno

Table of contents Preface What is Deno? Compariso...

Vue network request scheme native network request and js network request library

1. Native network request 1. XMLHttpRequest (w3c ...

Application of CSS3 animation effects in activity pages

background Before we know it, a busy year is comi...

Implementation code for infinite scrolling with n container elements

Scenario How to correctly render lists up to 1000...

How to modify mysql permissions to allow hosts to access

Enable remote access rights for mysql By default,...

Function overloading in TypeScript

Table of contents 1. Function signature 2. Functi...

How to implement vertical text alignment with CSS (Summary)

The default arrangement of text in HTML is horizo...

How to use html css to control div or table to be fixed in a specified position

CSS CodeCopy content to clipboard .bottomTable{ b...

A brief analysis of the game kimono memo problem

Today, after the game was restarted, I found that...