当前位置:网站首页>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 .
边栏推荐
- Sequence model
- C语言-入门-基础-语法-[运算符,类型转换](六)
- The map set type is stored in the form of key value pairs, and the iterative traversal is faster than the list set
- awk从入门到入土(8)数组
- 2022 examination questions for safety managers of metal and nonmetal mines (underground mines) and examination papers for safety managers of metal and nonmetal mines (underground mines)
- Awk from entry to earth (12) awk can also write scripts to replace the shell
- Fault analysis | MySQL: unique key constraint failure
- Awk from entry to earth (18) GAW K line manual
- Educational Codeforces Round 115 (Rated for Div. 2)
- 没有Kubernetes怎么玩Dapr?
猜你喜欢

ctfshow web255 web 256 web257

ArcGIS application (XXII) ArcMap loading lidar Las format data

What if the wireless network connection of the laptop is unavailable

awk从入门到入土(12)awk也可以写脚本,替代shell

OpenFeign 服务接口调用

Codeforces Round #803 (Div. 2)(A-D)

Awk from entry to earth (12) awk can also write scripts to replace the shell

Codeforces Round #750 (Div. 2)(A,B,C,D,F1)
![Private collection project practice sharing [Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources](/img/f9/6c97697896cd1bd0f1d62542959f29.jpg)
Private collection project practice sharing [Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources

到底什么才是DaaS数据即服务?别再被其他DaaS概念给误导了
随机推荐
Awk from entry to earth (18) GAW K line manual
[untitled] 2022 polymerization process analysis and polymerization process simulation examination
C语言-入门-基础-语法-[标识符,关键字,分号,空格,注释,输入和输出](三)
std::is_ union,std::is_ class,std::integral_ constant
Call Baidu map to display the current position
Horizon sunrise X3 PI (I) first boot details
How to re enable local connection when the network of laptop is disabled
AcWing 244. Enigmatic cow (tree array + binary search)
awk从入门到入土(7)条件语句
Guanghetong's high-performance 4g/5g wireless module solution comprehensively promotes an efficient and low-carbon smart grid
[error record] no matching function for call to 'cacheflush' cacheflush();)
NewH3C——ACL
How to choose solid state hard disk and mechanical hard disk in computer
Newh3c - network address translation (NAT)
[attack and defense world | WP] cat
DM8 database recovery based on point in time
Private collection project practice sharing [Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
Flutter integrated amap_ flutter_ location
Codeforces Global Round 21(A-E)
Educational Codeforces Round 119 (Rated for Div. 2)