In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This morning, my colleague said that the MySQL root account could not be logged in. I tried it.
# mysql-u root-p
Prompt "Access denied for user 'root'@'localhost' (using password: YES)"
Because a colleague left after the end of the year, my first reaction was who changed the root password? Reset the password by forgetting the root password:
# / etc/init.d/mysql stop
# mysqld_safe-skip-grant-tables &
# mysql-uroot-p
Mysql > update mysql.user set password=password ('mypassword') where user='root'
Mysql > flush privileges
Mysql > quit
Still unable to log in with the new password, the prompt is the same as above. Log in to a non-root account and check the user table:
Mysql > select user,host from user
+-+-
| | user | host |
+-+-
| | root | 127.0.0.1 | |
| | night |% | |
+-+-
Suspect that the default localhost is not mapped to 127.0.0.1? Try # mysql-u root-p xxxx-h 127.0.0.1, and you can log in.
The student who configured the database before did not authorize 'root'@'localhost'' and 'root'@'ip''.
Grant all privileges on. To 'root'@'localhost' identified by' mypassword' with grant option
Grant all privileges on. To 'root'@'118.192.91.xxx' identified by' mypassword' with grant option
Check the user table again:
Write the picture description here.
Then # mysql-u root-p xxxx, login is successful!
Check the difference between mysql-h localhost and mysql-h 127.0.0.1. You use UNIX socket to connect to mysql through localhost and TCP/IP to connect to mysql through 127.0.0.1. Look at the status:
Mysql-h localhost > status
Connection id: 639
Current database: mysql
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: "
Using delimiter:
Server version: 5.6.15-log Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Mysql-h 127.0.0.1 > status
Connection id: 640
Current database: mysql
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: "
Using delimiter:
Server version: 5.6.15-log Source distribution
Protocol version: 10
Connection: 127.0.0.1 via TCP/IP
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.