In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following is about some common knowledge about managing Mysql users. The secret of the text is to be close to the topic. So, no gossip, let's go straight to the following, I believe you will benefit from reading this article on some common knowledge of managing Mysql users.
User and host currently in use:
Mysql > select USER (); +-+ | USER () | +-+ | root@localhost | +-+ 1 row in set (0.00 sec)
Add user
Previous versions of mysql5 directly used INSERT to insert mysql users into the mysql table, which cannot be done after mysql5
Mysql > insert into mysql.user (Host,User,Password) values ('localhost','test_user',password (' 123123')); ERROR 1062 (23000): Duplicate entry 'localhost-test_user' for key' PRIMARY'
Add user {Grant user permission to specify data table [use GRANT command to authorize user]}
Mysql > GRANT all privileges ON table1.* TO 'test_user'@'localhost' IDENTIFIED BY' 123123 'WITH GRANT OPTION;Query OK, 0 rows affected (0.02 sec)
IDENTIFIED BY specifies the login password of the user
ALL PRIVILEGES means all permissions. You can also use select, update, and other permissions.
The preceding * sign in *.\ is used to specify the database name, and the subsequent * sign is used to specify the table name.
TO means to grant permissions to a user
ON is used to specify which libraries and tables the permissions are for.
'test_user'@'localhost' stands for test_user user, @ followed by restricted host, can be IP, IP segment, domain name and%,% means anywhere
The option WITH GRANT OPTION means that the user can delegate the permissions he has to others.
The system permission table [flush privilege] needs to be refreshed for this user to log in effectively.
Mysql > flush privileges
Delete user
Mysql > drop user' test_user'@'localhost'
View the permissions of the current user
Mysql > SHOW GRANTS +- -+ | Grants for root@localhost | +-- -+ | GRANT ALL PRIVILEGES ON *. * TO 'root'@'localhost' IDENTIFIED BY PASSWORD'\ * E56A114692FE0DE073F9A1DD68A00EEB9703F3F1' WITH GRANT OPTION | | GRANT PROXY ON'@''TO 'root'@'localhost' WITH GRANT OPTION | +-- -+
View the permissions of a user
Mysql > show grants for 'test_user'@'localhost'+- -- + | Grants for test_user@localhost | + -- + | GRANT USAGE ON *. * TO 'test_user'@'localhost' IDENTIFIED BY PASSWORD'\ * E56A114692FE0DE073F9A1DD68A00EEB9703F3F1' | GRANT ALL PRIVILEGES ON table1.* TO 'test_user'@'localhost' WITH GRANT OPTION | +- -+
Rename an account
Mysql > rename user' test_user'@'localhost' to 'bb'@'localhost'
Modify the password
1. Use the set password command
Mysql > SET PASSWORD FOR 'test_user'@'localhost' = PASSWORD (' 123456')
two。 Use mysqladmin [enter the bin directory]
Remarks: {format: mysqladmin-u user name-p old password password new password]
/ usr/bin$ mysqladmin-utest_user-p123456 password 123123mysqladmin: Can't turn off logging; error: 'Access denied; you need (at least one of) the SUPER privilege (s) for this operation'
3. Edit the user table directly with update
Mysql > use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with-ADatabase changedmysql > update user set PASSWORD = PASSWORD ('123123') where user = 'test_user';Query OK, 1 row affected (0.04 sec) Rows matched: 1 Changed: 1 Warnings: 0
Is there anything you don't understand about some of the common knowledge related to managing Mysql users? Or if you want to know more about it, you can continue to follow our industry information section.
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.