当前位置:网站首页>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 !
边栏推荐
- 从零开始的基于百度大脑EasyData的多人协同数据标注
- [机缘参悟-37]:人感官系统的结构决定了人类是以自我为中心
- Logback log sorting
- Flutter dynamic | fair 2.5.0 new version features
- GoLand 2021.2 configure go (go1.17.6)
- 顺序表(C语言实现)
- Go language unit test 5: go language uses go sqlmock and Gorm to do database query mock
- Unity Render Streaming通过Js与Unity自定义通讯
- Flutter动态化 | Fair 2.5.0 新版本特性
- [quantitative trading] permanent portfolio, turtle trading rules reading, back testing and discussion
猜你喜欢
Kivy教程之 盒子布局 BoxLayout将子项排列在垂直或水平框中(教程含源码)
Golang - command line tool Cobra
Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station
Unable to stop it, domestic chips have made another breakthrough, and some links have reached 4nm
Unity EmbeddedBrowser浏览器插件事件通讯
Comprehensively develop the main channel of digital economy and digital group, and actively promote the utonmos digital Tibet market
There is nothing new under the sun. Can the meta universe go higher?
SQL Injection (POST/Select)
Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS
MyCms 自媒体商城 v3.4.1 发布,使用手册更新
随机推荐
Golang — 命令行工具cobra
Software testing is so hard to find, only outsourcing offers, should I go?
Unable to stop it, domestic chips have made another breakthrough, and some links have reached 4nm
The latest BSC can pay dividends. Any B usdt Shib eth dividend destruction marketing can
The network card fails to start after the cold migration of the server hard disk
IBEM 数学公式检测数据集
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
[how to earn a million passive income]
[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered
IBEM mathematical formula detection data set
JSON serialization case summary
There is nothing new under the sun. Can the meta universe go higher?
栈应用(平衡符)
SQL Injection (POST/Search)
Comprehensive evaluation of double chain notes remnote: fast input, PDF reading, interval repetition / memory
SQL Injection (POST/Select)
[today in history] July 3: ergonomic standards act; The birth of pioneers in the field of consumer electronics; Ubisoft releases uplay
PhpMyAdmin stage file contains analysis traceability
Unity EmbeddedBrowser浏览器插件事件通讯
[技术发展-24]:现有物联网通信技术特点