当前位置:网站首页>Solve MySQL 1045 access denied for user 'root' @ 'localhost' (using password: yes)
Solve MySQL 1045 access denied for user 'root' @ 'localhost' (using password: yes)
2022-07-03 13:50:00 【Procedural ape Dabo】
I have a problem recently , Just can't connect to the backstage mysql database , use navicat Open the database prompt 1045 Access denied for user 'root'@'localhost' (using password: YES). There is a solution to this problem online , But the whole network has copied one person , And did not give exactly what caused the problem . Today, I will explain the reason for this problem and two ways to solve it !

reason :
1. The database password has been tampered !
you 're right , That's why . But many people will immediately refute , My own computer has been working well , How could it be tampered with ? Hackers are powerful , Tampering with your database password is not the main purpose , The purpose is to enter your database after tampering, back up the database files, and then delete the local database , Threatening you to ask for bitcoin is the main purpose .
2. Database permissions have changed !
This reason has a lot to do with the change of account permissions of your machine , There are many actual scenarios , No more examples .
Here are two solutions , According to personal preferences, any one can
Method 1 :
edit mysql The configuration file my.ini( stay mysql Installation directory , Different computers may be different , Refer to the directory ①D:\Program Files\MySQL\MySQL Server 5.0\my.ini;②C:\ProgramData\MySQL\MySQL Server 8.0\my.ini;), stay [mysqld] Add... Under this item skip-grant-tables Save, exit and restart mysql
1. open cmd, Click on “ Start ”->“ function ”( Shortcut key Win+R).
2. stop it : Input net stop mysql
3. start-up : Input net start mysql
It can also be on the computer - management - Found in the service MySQL Service for , Pictured

At this time cmd In the input mysql -u root -p You can log in without a password , appear password: You can enter when you enter , There will be no ERROR 1045 (28000), But many operations are limited , Because no grant jurisdiction .
Continue to follow the following process :
1. Get into mysql database :
mysql> use mysql;
Database changed
2. to root The user sets a new password :
mysql> update user set password=password(" New password ") where user="root";
Query OK, 1 rows affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
3. Refresh database
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
4. sign out mysql:
mysql> quit;
Bye
After being changed , Let me revise it a little bit my.ini This file , Take what we just joined "skip-grant-tables" This line is deleted , Save, exit and restart mysql service , Reuse Navicat Just connect .

Method 2 :
Uninstall the original database , Including main program 、 Registry and C Disk folder , But you must pay attention to backup C disc C:\ProgramData\MySQL\MySQL Server ( The database version you uninstalled )\data The following database file , This is your previous database table file , To restore the database, you must back it up , Data can be recovered later . Besides , This folder is hidden by default .
Copy data Under the folder, the database you created before , Names are corresponding , You can know which database you created when you have an impression , There are also three files that must be backed up , Look at the picture :

After backing up these files , Uninstall the original database program and delete the folder and registry , Shut down the database service after reinstalling the database , Put the backup file in the corresponding location , Click to replace those with duplicate names , Then restart the database service . At this time, open the database , You will find that the original database has appeared , It's as like as two peas !
边栏推荐
- IBEM mathematical formula detection data set
- ThreadPoolExecutor realizes multi-threaded concurrency and obtains the return value (elegant and concise way)
- 又一个行业被中国芯片打破空白,难怪美国模拟芯片龙头降价抛售了
- 静态链表(数组的下标代替指针)
- 从零开始的基于百度大脑EasyData的多人协同数据标注
- SQL Injection (GET/Search)
- Bidirectional linked list (we only need to pay attention to insert and delete functions)
- [how to earn a million passive income]
- Unity embeddedbrowser browser plug-in event communication
- Golang — template
猜你喜欢

CVPR 2022 | interpretation of 6 excellent papers selected by meituan technical team

Common network state detection and analysis tools

NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线

There is nothing new under the sun. Can the meta universe go higher?

刚毕业的欧洲大学生,就能拿到美国互联网大厂 Offer?

The solution of Chinese font garbled code in keil5

Go language web development series 27: Gin framework: using gin swagger to implement interface documents

Can newly graduated European college students get an offer from a major Internet company in the United States?

Flutter动态化 | Fair 2.5.0 新版本特性

Bidirectional linked list (we only need to pay attention to insert and delete functions)
随机推荐
Static linked list (subscript of array instead of pointer)
Start signing up CCF C ³- [email protected] chianxin: Perspective of Russian Ukrainian cyber war - Security confrontation and sanctions g
Implementation of Muduo accept connection, disconnection and sending data
[how to solve FAT32 when the computer is inserted into the U disk or the memory card display cannot be formatted]
[technology development-24]: characteristics of existing IOT communication technology
Unity Render Streaming通过Js与Unity自定义通讯
Bidirectional linked list (we only need to pay attention to insert and delete functions)
[how to earn a million passive income]
Richview trvstyle liststyle list style (bullet number)
The network card fails to start after the cold migration of the server hard disk
软件测试工作那么难找,只有外包offer,我该去么?
Leetcode-1175.Prime Arrangements
Unity render streaming communicates with unity through JS
Students who do not understand the code can also send their own token, which is easy to learn BSC
【BW16 应用篇】安信可BW16模组与开发板更新固件烧录说明
This math book, which has been written by senior ml researchers for 7 years, is available in free electronic version
Another industry has been broken by Chinese chips. No wonder the leading analog chip companies in the United States have cut prices and sold off
Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.
Which securities company has the lowest Commission for opening an account online? I want to open an account. Is it safe for the online account manager to open an account
SQL Injection (POST/Select)