background
I haven't used sql for a long time, and when I open it in cmd, I report an error:
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
go through
When I first logged in, it reported ERROR 2003.
Open "Service", there is no MySQL at this time
Solution:
mysqld --install
net start mysql
Then type:
mysql -u root -p
Just report an error:
I suspect that the previous reinstallation of sql caused the problem.
Solution
Edit my.ini configuration: add skip-grant-tables under [mysqld] and save it.
Specific process:
my.ini is on the directory of sql. If you forget the location of sql, you canSearch for "service", find MySQL, right-click properties,You will know where it is installed.
Find the corresponding location, right-click my.ini, and edit in Notepad:
Add it under [mysqld] and save it.
skip-grant-tables
Then you can log in.