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

Detailed explanation of four types of MySQL connections and multi-table queries

Table of contents MySQL inner join, left join, ri...

How to get the size of a Linux system directory using the du command

Anyone who has used the Linux system should know ...

How to solve the problem of clicking tomcat9.exe crashing

A reader contacted me and asked why there were pr...

Summary of MySQL lock related knowledge

Locks in MySQL Locks are a means to resolve resou...

Detailed explanation of basic operation commands for Linux network settings

Table of contents View network configuration View...

Detailed explanation of JavaScript program loop structure

Table of contents Select Structure Loop Structure...

When to use table and when to use CSS (experience sharing)

The main text page of TW used to have a width of 8...

Detailed explanation of application scenarios of filters in Vue

filter is generally used to filter certain values...

XHTML Getting Started Tutorial: Using the Frame Tag

<br />The frame structure allows several web...

In-depth analysis of Flex layout in CSS3

The Flexbox layout module aims to provide a more ...

Linux Check the installation location of the software simple method

1. Check the software installation path: There is...

Detailed explanation of Angular dynamic components

Table of contents Usage scenarios How to achieve ...

React Native JSI implements sample code for RN and native communication

Table of contents What is JSI What is different a...

Linux disk sequential writing and random writing methods

1. Introduction ● Random writing will cause the h...

Several ways to use require/import keywords to import local images in v-for loop

Table of contents Problem Description Method 1 (b...