What to do if you forget the initial password when installing MySQL on Mac

What to do if you forget the initial password when installing MySQL on Mac

Forgetting the password is a headache. What should I do if I forget the initial password for installing MySQL on Mac? The specific solutions are as follows

http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

I have tried method 3 and successfully reset my password.

(Thanks @非常, who told me that there is a reset method on the official website. I searched a lot on the Internet...
In addition, step 1 and 2 are from the quick solution of forgetting the root password or permission error of Mysql on MAC

My English is not good, so I don’t quite understand the official one##)

step1:

Apple->System Preferences->Click MySQL at the bottom. In the pop-up page, turn off the MySQL service (click Stop MySQL Server).

step2:

Enter the terminal and enter: cd /usr/local/mysql/bin/
After pressing Enter, log in with administrator privileges sudo su
After pressing Enter, enter the following command to disable the mysql authentication function./mysqld_safe --skip-grant-tables &
After pressing Enter, MySQL will automatically restart (the status of MySQL in the preferences will become running)


step3.

Enter the command ./mysql
After pressing Enter, enter the command FLUSH PRIVILEGES;
After pressing Enter, enter the command SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your new password');


At this point, the password change is complete and you can log in successfully.

For more information about MySQL password operations, please refer to the topic: MySQL password operations summary for learning.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • The problem of not being able to remember the SVN password of idea under mac and the solution
  • Example code for resetting PostgreSQL password on Mac
  • Solution to the problem that IntelliJ IDEA's SVN cannot save passwords on MAC
  • How to reset mysl8.0.11 password on mac
  • How to set password for mysql version 5.6 on mac
  • Tutorial on resetting the root password of Mac MySQL
  • Solution to forgetting the MYSQL database password under MAC
  • Solution to forget password when installing MySQL on Linux/Mac
  • Common methods for retrieving system account and password on MAC

<<:  Nginx sample code for implementing dynamic and static separation

>>:  javascript to switch by clicking on the picture

Recommend

Solution to the problem of mysql service starting but not connecting

The mysql service is started, but the connection ...

40+ Beautiful Web Form Design Examples

Web forms are the primary communication channel b...

Use of VNode in Vue.js

What is VNode There is a VNode class in vue.js, w...

Specific use of MySQL window functions

Table of contents 1. What is a window function? 1...

An article to help you understand the basics of VUE

Table of contents What is VUE Core plugins in Vue...

Detailed explanation of SSH password-free login configuration under Linux

Assume there are two Linux servers A and B, and w...

Detailed explanation of webpack-dev-server core concepts and cases

webpack-dev-server core concepts Webpack's Co...

Explanation of the configuration and use of MySQL storage engine InnoDB

MyISAM and InnoDB are the most common storage eng...

Example of using JS to determine whether an element is an array

Here are the types of data that can be verified l...

Understanding the Lazy Loading Attribute Pattern in JavaScript

Traditionally, developers create properties in Ja...

HTML (css style specification) must read

CSS style specifications 1. Class Selector 2. Tag...

Solve the problem of invalid utf8 settings in mysql5.6

After the green version of mysql5.6 is decompress...

How to create a flame effect using CSS

The main text starts below. 123WORDPRESS.COM Down...