Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve forgetting mysql password in MAC

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article shows you how to forget the mysql password in MAC, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

1. Shut down the mysql server

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

two。 Enter the directory

Cd / usr/local/mysql/bin

3. Get permission

Sudo su

4. Restart the server

. / mysqld_safe-- skip-grant-tables &

5.control + D quit Editing

6. Configure short commands

Alias mysql=/usr/local/mysql/bin/mysql

7. Enter mysql command mode

Mysql

8. Access to mysql database

Use mysql

9. Get permission to change

Flush privileges

10. Reset password

Set password for 'root'@'localhost'=password (' new password')

Case 2: if you often use home-brew installation to install software, you only need to change the path in the above steps. The default installation of mysql is / usr/local/Cellar/mysql/5.7.16, and you only need to change steps 1, 2 and 6 above / usr/local/mysql to / usr/local/Cellar/mysql/5.7.16.

Case 3: this situation belongs to the relatively crappy situation. After downloading mysql, I forgot this thing for a long time, and then downloaded another one. I found that the database downloaded first prompted me to enter the password directly. Then according to case 1 or case 2, the input command cannot be modified successfully. It is also useless to modify my.cnf (now my-default.cnf) in accordance with the method introduced online. If you unfortunately encounter this situation, please follow these steps

1. Uninstall mysql

Sudo rm / usr/local/mysql sudo rm-rf / usr/local/var/mysql sudo rm-rf / usr/local/mysql* sudo rm-rf / Library/StartupItems/MySQLCOM sudo rm-rf / Library/PreferencePanes/My* vim / etc/hostconfig and removed the line MYSQLCOM=-YES-rm-rf ~ / Library/PreferencePanes/My* sudo rm-rf / Library/Receipts/mysql* sudo rm-rf / Library/Receipts/MySQL* sudo rm-rf / var/db/receipts/com.mysql.* the above is how to resolve the forgotten mysql password in MAC Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report