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

How InnoDB cleverly implements transaction isolation levels

Preface In the previous article Detailed Explanat...

HTML embedded in WMP compatible with Chrome and IE detailed introduction

In fact, there are many corresponding writing met...

Several ways to generate unique IDs in JavaScript

Possible solutions 1. Math.random generates rando...

Solution to the failure of docker windows10 shared directory mounting

cause When executing the docker script, an error ...

Understand the principles of MySQL persistence and rollback in one article

Table of contents redo log Why do we need to upda...

MySQL 8.0.12 Quick Installation Tutorial

The installation of MySQL 8.0.12 took two days an...

How to configure nginx+php+mysql in docker

First, understand a method: Entering a Docker con...

Implementation of form submission in html

Form submission code 1. Source code analysis <...

How to insert pictures into HTML pages and add map index examples

1. Image formats supported on the WEB: GIF: can s...