In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "how mysql rebuilds local users and remote users". In daily operation, I believe that many people have doubts about how mysql reconstructs local users and remote users. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how mysql rebuilds local users and remote users". Next, please follow the editor to study!
1. Simulated deletion and destruction of users:
Laojiang:~ # mysql-uroot-proot
Mysql > use mysql
Mysql > select user,host from user
+-+ +
| | user | host |
+-+ +
| | laojiang |% | |
| | laojiang | 127.0.0.1 | |
| | root | 127.0.0.1 | |
| | root |:: 1 |
| | root | laojiang |
| | laojiang | localhost |
| | root | localhost |
| | laojiang | laojiang |
+-+ +
8 rows in set (0.00 sec)
Mysql > delete from user where user='root'
Query OK, 4 rows affected (0.00 sec)
Mysql > select user,host from user
+-+ +
| | user | host |
+-+ +
| | laojiang |% | |
| | laojiang | 127.0.0.1 | |
| | laojiang | localhost |
| | laojiang | laojiang |
+-+ +
4 rows in set (0.00 sec)
Mysql >
Laojiang:~ # service mysql restart
Shutting down MySQL.. Done
Starting MySQL. Done
Laojiang:~ # mysql-uroot-proot
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Laojiang:~ #
2. Rebuild local users:
Laojiang:/etc # vi my.cnf
[mysqld]
Skip-grant-tables
Laojiang:~ # service mysql restart
Shutting down MySQL.. Done
Starting MySQL.
Laojiang:~ # mysql-uroot-p
Enter password:
Mysql > insert into mysql.user (host, user, password,ssl_cipher,x509_issuer,x509_subject) values ('localhost',' root', password ('root'),')
Query OK, 1 row affected (0.00 sec)
Mysql > flush privileges
Query OK, 0 rows affected (0.00 sec)
Mysql > grant all privileges on *. * to 'root'@'localhost' identified by' root' with grant option
Query OK, 0 rows affected (0.00 sec)
Mysql >
Laojiang:/etc # vi my.cnf
[mysqld]
# skip-grant-tables
Laojiang:~ # service mysql restart
Shutting down MySQL.. Done
Starting MySQL. Done
Third, rebuild the remote user through the local user:
Laojiang:~ # mysql-uroot-proot
Mysql > select user,host from mysql.user
+-+ +
| | user | host |
+-+ +
| | laojiang |% | |
| | laojiang | 127.0.0.1 | |
| | laojiang | localhost |
| | root | localhost |
| | laojiang | laojiang |
+-+ +
5 rows in set (0.00 sec)
Mysql > grant all privileges on *. * to 'root'@'%' identified by' root' with grant option
Query OK, 0 rows affected (0.00 sec)
Mysql > select user,host from mysql.user
+-+ +
| | user | host |
+-+ +
| | laojiang |% | |
| | root |% | |
| | laojiang | 127.0.0.1 | |
| | laojiang | localhost |
| | root | localhost |
| | laojiang | laojiang |
+-+ +
6 rows in set (0.00 sec)
Mysql >
At this point, the study on "how mysql rebuilds local and remote users" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.