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

Using Nginx to implement grayscale release

Grayscale release refers to a release method that...

Solution to no Chinese input method in Ubuntu

There is no solution for Chinese input method und...

Complete steps to quickly build a vue3.0 project

Table of contents 1. We must ensure that the vue/...

MySQL date processing function example analysis

This article mainly introduces the example analys...

Undo log in MySQL

Concept introduction: We know that the redo log i...

Website Color Schemes Choosing the Right Colors for Your Website

Does color influence website visitors? A few year...

Seven Principles of a Skilled Designer (1): Font Design

Well, you may be a design guru, or maybe that'...

How to implement adaptive container with equal aspect ratio using CSS

When developing a mobile page recently, I encount...

Dynamic SQL statement analysis in Mybatis

This article mainly introduces the dynamic SQL st...

Native javascript+CSS to achieve the effect of carousel

This article uses javascript+CSS to implement the...

Example code for implementing ellipse trajectory rotation using CSS3

Recently, the following effects need to be achiev...

Detailed explanation of commonly used nginx rewrite rules

This article provides some commonly used rewrite ...

Web design dimensions and rules for advertising design on web pages

1. Under 800*600, if the width of the web page is...