What to do if you forget the initial password of MySQL on MAC

What to do if you forget the initial password of MySQL on MAC

The solution to forgetting the initial password of MySQL under MAC is shared with you for your reference. The specific content is as follows

After installing the MySQL dmg from the official website.

1 Set up mysql command

From the terminal, type

mysql --version

If the version number is displayed, it is normal; if it shows command not found, follow the code below to link the installation path

cd /usr/local/bin/
sudo ln -fs /usr/local/mysql/bin/mysql mysql

2. Shut down the mysql service

sudo /usr/local/mysql/support-files/mysql.server stop

3 Start mysql in safe mode

sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

Then open the system preferences, select mysql, and you will find the mysql service and restart it.

4 Return to the terminal

Command + N to reopen a terminal and enter

mysql -u root

At this time, you can directly enter mysql without a password, and you can modify any password.

5 Change the password in the new terminal

mysql> FLUSH PRIVILEGES;
mysql> SET PASSWORD FOR root@'localhost' = PASSWORD('123');
// You can also modify other passwords // Finally refresh mysql> FLUSH PRIVILEGES;

After that, you can log in to mysql with the new password.

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:
  • What to do if you forget the initial password when installing MySQL on Mac
  • How to install and modify the initial password of mysql5.7.18 under Centos7.3
  • How to modify the initial password of a user in mysql5.7
  • What to do if you forget the initial password of MySQL on MAC
  • A simple and effective solution to forget the initial password when installing MySQL

<<:  Vue implements the shake function (compatible with ios13.3 and above)

>>:  How to handle images in Vue forms

Recommend

Detailed tutorial on how to install MySQL 5.7.18 in Linux (CentOS 7) using YUM

The project needs to use MySQL. Since I had alway...

Linux disk sequential writing and random writing methods

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

How to elegantly implement WeChat authorized login in Vue3 project

Table of contents Preface Prepare Implementation ...

In-depth explanation of Mysql deadlock viewing and deadlock removal

Preface I encountered a Mysql deadlock problem so...

Detailed explanation of nginx request header data reading process

In the previous article, we explained how nginx r...

Implementation of iview permission management

Table of contents iview-admin2.0 built-in permiss...

HTML Basic Notes (Recommended)

1. Basic structure of web page: XML/HTML CodeCopy...

HTML CSS3 does not stretch the image display effect

1. Use the transform attribute to display the ima...

How to configure Linux to use LDAP user authentication

I am using LDAP user management implemented in Ce...

MySQL 8.0.12 Installation and Usage Tutorial

Recorded the installation and use tutorial of MyS...

【HTML element】Detailed explanation of tag text

1. Use basic text elements to mark up content Fir...

Docker uses the Prune command to clean up the none image

Table of contents The creation and confusion of n...

Solution to the problem that Java cannot connect to MySQL 8.0

This article shares a collection of Java problems...