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--
This article will explain in detail the solutions that can not be accessed by users when you add mysql. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Mysql adds solutions that users can't access: first log in to the MySQL server as an administrator and create a MySQL user; then give the MySQL user privileges and run the following command to give the "myuser" user specific permissions; finally, add resource restrictions for the user and verify.
Mysql adds solutions that users cannot access:
First log in to the MySQL server as an administrator.
$mysql-u root-p
Check that there are users who have been created
SELECT host, user FROM mysql.user
Create a MySQL user
Create a user whose username and password are "myuser" and "mypassword", respectively, and the accessible address is% all, or you can set ip or localhost. After the mysql > CREATE USER 'myuser'@'%' IDENTIFIED BY' mypassword'; user is created, all account details, including encrypted passwords, permissions, and resource restrictions, are stored in the user table of the mysql library. * * run the following command to verify whether the account is created successfully * * mysql > SELECT host, user, password FROM mysql.user WHERE user='myuser'
Give MySQL user permissions
A new MySQL user doesn't have any access, which means you can't do anything in the MySQL database. You have to give the user the necessary permissions. Here are some available permissions:
ALL: all available permissions
CREATE: create libraries, tables, and indexes
LOCK_TABLES: locking tabl
ALTER: modifying tabl
DELETE: deleting tables
INSERT: inserts a table or column
SELECT: retrieving data from a table or column
CREATE_VIEW: creating view
SHOW_DATABASES: listing databases
DROP: deleting libraries, tables, and views
Run the following command to give the "myuser" user specific permissions.
Mysql > GRANT ON. The above command TO 'myuser'@'localhost'; represents a comma-separated list of permissions. If you want to grant permissions to any database (or table), use an asterisk (*) instead of the name of the database (or table). For example, give CREATE and INSERT permissions to all databases / tables: mysql > GRANT CREATE, INSERT ON *. * TO 'myuser'@'localhost'
Verify the full permissions assigned to the user:
Mysql > SHOW GRANTS FOR 'myuser'@'localhost'; * * grants full permissions to all databases / tables: * * mysql > GRANT ALL ON *. * TO' myuser'@'localhost'; * * you can also delete the user's existing permissions. Use the following command to revoke the existing permissions for the "myuser" account: * * mysql > REVOKE ON. FROM 'myuser'@'localhost'
Add resource restrictions for the user
In MySQL, you can set resource usage limits for MySQL for individual users. The limits of available resources are as follows:
MAX_QUERIES_PER_HOUR: maximum number of requests allowed per hour MAX_UPDATES_PER_HOUR: maximum number of updates allowed per hour MAX_CONNECTIONS_PER_HOUR: maximum connections allowed per hour (LCTT: together with the MySQL global variable: max_user_connections determines the number of simultaneous connections to the database) MAX_USER_CONNECTIONS: simultaneous connections to the server
Add a resource limit to the "myuser" account using the following command:
Mysql > GRANT USAGE ON. In TO 'myuser'@'localhost' WITH; you can specify multiple resource restrictions separated by spaces. For example, increase MAXQUERIESPERHOUR and MAXCONNECTIONSPERHOUR resource limits: mysql > GRANT USAGE ON *. * TO 'myuser'@'localhost' WITH MAX_QUERIES_PER_HOUR 30 MAX_CONNECTIONS_PER_HOUR 6
Verify the user's resource limits:
Mysql > SHOW GRANTS FOR 'myuser'@'localhost
The last important step in creating and setting up a MySQL user:
Mysql > FLUSH PRIVILEGES
In this way, the change takes effect. Now the MySQL user account can be used.
On mysql to add solutions that users can not access to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.