


How to reset the MySQL password after forgetting it under Mac operating system_MySQL
Aug 20, 2016 am 08:48 AMAfter installing MySQL, the system gives a default password and then says if you forget the default password. . . . . . I copied the default password and took just one step. This step was the beginning of my long journey. The password he gave me was too complicated, so of course I had to change it, and I had to pretend I didn’t remember the password, so I was on the road to no return. . . . . .
This process is sad. There is so much information on the Internet. The key is that everyone has their own wrong methods. After trying for a long time, there is no right one. When I am about to break the psychological defense and go through the MySQL documentation, I have successfully changed it. . No article gave me the complete answer. I consulted several guides and built the car behind closed doors. Give yourself a thumbs up. Without further ado, just follow me step by step.
Close the mysql server
sudo /usr/local/mysql/support-files/mysql.server stop
You can also turn it off in MySQL in the system preferences.
cd /usr/local/mysql/bin 进入目录 sudo su 获取权限 ./mysqld_safe --skip-grant-tables & 重启服务器 重开个终端,
Configuration short command:
alias mysql=/usr/local/mysql/bin/mysql
Enter mysql to enter the mysql command mode
use mysql to enter the mysql database
flush privileges; probably to obtain permissions, Otherwise he won't let you change it.
set password for 'root'@'localhost'=password('new password'); Completed the modification
Oh my God, I finally changed it.
If you know the password:
mysqladmin -u root -p password New password. . . . . . . . . . .
The above is the method that the editor introduces to you on how to reset the MySQL password after forgetting it on Mac. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support of the website!
PS: Quick solution for forgotten MYSQL database password under Mac operating system
1. In the system preferences, stop the MYSQL service.;
2. cd /usr/local/mysql-... ../bin
sudo ./mysqld_safe--skip-grant-tables
3. Log in to MySQL;
mysql
4. Leave the root user’s password blank;
mysql> update mysql.user set password=‘' whereUser='root'; mysql> flush privileges; mysql> quit
5. Restart MySQL service,
6. Add password mysql> mysqladmin -u root -p password 123 Change the password to 123
The above is how to reset the MySQL password after forgetting it under the Mac operating system_MySQL content, more related content Please pay attention to the PHP Chinese website (www.php.cn)!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP's big data structure processing skills

How to optimize MySQL query performance in PHP?

How to use MySQL backup and restore in PHP?

What are the application scenarios of Java enumeration types in databases?

How to insert data into a MySQL table using PHP?

Apple iPhone 16 is no longer pre-installed with Apple Intelligence

How to fix mysql_native_password not loaded errors on MySQL 8.4

ChatGPT is now available for macOS with the release of a dedicated app
