当前位置:网站首页>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 .
边栏推荐
- The old-fashioned synchronized lock optimization will make it clear to you at once!
- Ehrlich sieve + Euler sieve + interval sieve
- [BSP video tutorial] stm32h7 video tutorial phase 5: MDK topic, system introduction to MDK debugging, AC5, AC6 compilers, RTE development environment and the role of various configuration items (2022-
- [error record] no matching function for call to 'cacheflush' cacheflush();)
- Learn nuxt js
- C#,数值计算(Numerical Recipes in C#),线性代数方程的求解,Gauss-Jordan消去法,源代码
- Awk from entry to penetration (6) regular matching
- Awk from getting started to digging in (4) user defined variables
- How college students choose suitable computers
- OpenFeign 服务接口调用
猜你喜欢

没有Kubernetes怎么玩Dapr?
![C language - Introduction - Foundation - syntax - [operators, type conversion] (6)](/img/3f/4d8f4c77d9fde5dd3f53ef890ecfa8.png)
C language - Introduction - Foundation - syntax - [operators, type conversion] (6)

地平线 旭日X3 PI (一)首次开机细节

FOC控制

Ehrlich sieve + Euler sieve + interval sieve

What sparks can applet container technology collide with IOT

ES6 summary

How to solve the problem that computers often flash

How does Xiaobai buy a suitable notebook

ctfshow web255 web 256 web257
随机推荐
C language - Introduction - Foundation - syntax - [variable, constant light, scope] (V)
L1 regularization and L2 regularization
What is inner connection and outer connection? What are the uses and benefits
20220701 Barbalat引理证明
[CV] Wu Enda machine learning course notes | Chapter 9
C language - Introduction - Foundation - syntax - [operators, type conversion] (6)
Ehrlich sieve + Euler sieve + interval sieve
C language - Introduction - Foundation - syntax - data type (4)
ES6 summary
Codeforces Round #750 (Div. 2)(A,B,C,D,F1)
20220701 barbarat lemma proof
Démarrage des microservices: passerelle
What should I do if there is a problem with the graphics card screen on the computer
微服务入门:Gateway网关
High order phase difference such as smear caused by myopic surgery
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)
Basic discipline formula and unit conversion
awk从入土到入门(10)awk内置函数
How to pass custom object via intent in kotlin
CLion-控制台输出中文乱码