当前位置:网站首页>Mac platform forgets the root password of MySQL
Mac platform forgets the root password of MySQL
2022-07-04 08:52:00 【sanqima】
MySQL The database has not been used for a long time , Use... In recent days MySQL, Find out root I forgot the password . But also good , have access to MySQL Security mode to modify root password . The specific method is as follows :
1 stop it MySQL service
Method 1 : Close with command
In the black frame , Enter the following command , To close MySQL service , Pictured (1) Shown .
sudo /usr/local/mysql/support-files/mysql.server stop

Method 2 : stay [ System preferences ] Inside closed



If you click [Stop MySQL Server] The button doesn't respond , Then enter the following command in the command line , avoid MySQL Restart again and again :
sudo launchctl unload -w /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo pkill mysqld
2 Enter safe mode
## Get into MySQl Installation directory
cd /usr/local/mysql/bin
## Turn on safe mode
sudo ./mysqld_safe --skip-grant-tables --skip-networking
3 modify root password
3.1 update command
Reopen a black box console , Enter the following command :
## With root Enter the database as , If there is a password prompt , Then go straight back
./mysql -u root
## Use the name mysql The database of
use mysql;
## Update the password
update user set authentication_string=password(' Your password ') where user='root';
## Save password
flush privileges;
## sign out
exit
3.2 alter command
Press Ctrl+Z Close the black window in safe mode , Re enter mySQL database , Use alter command , Change the password for the second time ( The password here is the same as the first time ), as follows :
cd /usr/local/mysql/bin
./mysql -u root -p
Enter the new password just set
alter user 'root'@'localhost' identified by ' Your password ';
flush privileges;
exit
- situation 1) Forgotten password :
Enter safe mode , Password to be set 2 Time , For the first time update command , The second, alter command . - situation 2) Update the password :
If you know the old password , You don't need to enter safe mode , Just use alter Just modify the command .
This method , in the light of MySQL v5.7.31 ~ v8 edition .
边栏推荐
- awk从入门到入土(15)awk执行外部命令
- How can we make a monthly income of more than 10000? We media people with low income come and have a look
- Educational Codeforces Round 119 (Rated for Div. 2)
- DM8 uses different databases to archive and recover after multiple failures
- 微服務入門:Gateway網關
- Snipaste convenient screenshot software, which can be copied on the screen
- Bishi blog (13) -- oral arithmetic test app
- awk从入门到入土(5)简单条件匹配
- Horizon sunrise X3 PI (I) first boot details
- How college students choose suitable computers
猜你喜欢
Manjaro install wechat
广和通高性能4G/5G无线模组解决方案全面推动高效、低碳智能电网
Snipaste convenient screenshot software, which can be copied on the screen
HMS core helps baby bus show high-quality children's digital content to global developers
ArcGIS应用(二十二)Arcmap加载激光雷达las格式数据
C language - Introduction - Foundation - syntax - [identifier, keyword, semicolon, space, comment, input and output] (III)
manjaro安装微信
转:优秀的管理者,关注的不是错误,而是优势
NewH3C——ACL
Bishi blog (13) -- oral arithmetic test app
随机推荐
manjaro安装微信
How to solve the problem that computers often flash
Codeforces Round #750 (Div. 2)(A,B,C,D,F1)
From scratch, use Jenkins to build and publish pipeline pipeline project
FOC control
awk从入门到入土(12)awk也可以写脚本,替代shell
What sparks can applet container technology collide with IOT
Report on research and investment prospects of polyglycolic acid industry in China (2022 Edition)
Learn nuxt js
Basic operations of databases and tables ----- view data tables
Fault analysis | MySQL: unique key constraint failure
awk从入门到入土(5)简单条件匹配
Private collection project practice sharing [Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
Awk from entry to earth (14) awk output redirection
Awk from digging into the ground to getting started (10) awk built-in functions
Review of last week's hot spots (6.27-7.3)
C # implements a queue in which everything can be sorted
[untitled] 2022 polymerization process analysis and polymerization process simulation examination
[Chongqing Guangdong education] National Open University spring 2019 455 logistics practice reference questions
What should I do if there is a problem with the graphics card screen on the computer