In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
MySQL cases of adding accounts, granting permissions, and deleting users? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!
1. Add account:
# create a testuser account with a password of 123456 # if you do not write [identified by '123456'], create a testuser account with an empty password mysql > create user testuser identified by' 123456 account # refresh permission change mysql > flush privileges
two。 Grant authority
# Grant all local access to all databases to the testuser account mysql > grant all privileges on *. * to 'testuser'@'localhost' identified by' 123456 permissions MySQL > flush privileges
Command format:
Grant privilegesCode on dbName.tableName to username@host identified by "password"
PrivilegesCode indicates the type of permission granted. The following types are commonly used:
All privileges: all permissions
Select: read permission
Delete: delete permission
Update: update permissions
Create: create permission
Drop: delete database and data table permissions.
The complete permission types are as follows:
Select_priv: Y Insert_priv: Y Update_priv: Y Delete_priv: Y Create_priv: Y Drop_priv: Y Reload_priv: Y Shutdown_priv: Y Process_priv: Y File_priv: Y Grant_priv: Y References_priv: Y Index_ Priv: Y Alter_priv: Y Show_db_priv: Y Super_priv: Y Create_tmp_table_priv: Y Lock_tables_priv: Y Execute_priv: Y Repl_slave_priv: Y Repl_client_priv: Y Create_view_priv: Y Show_view_priv: Y Create_routine_priv: Y Alter_routine_priv: Y Create_user _ priv: Y Event_priv: Y Trigger_priv: YCreate_tablespace_priv: Y
Detailed introduction of readable MySQL official documents
DbName.tableName represents a specific library or table that grants permissions. The following options are commonly used:
*. *: grant permissions to all tables in all databases of this database server
Permissions granted by dbName.*: to all tables in the dbName database
DbName.dbTable: Grant permissions to the dbTable table in the database dbName.
Username@host represents the granted user and the IP address that the user is allowed to log on to. There are several types of host:
Localhost: only this user is allowed to log in locally, not remotely.
%: allow remote login on any machine other than this machine.
192.168.1.11: a specific IP indicates that only this user is allowed to log in from a specific IP.
Identified by "password": indicates the password of the access user. Without this statement, the default password is empty.
View commands granted by permissions:
Mysql > show grants for 'testuser'
3. Delete user
# delete the testuser user with local access that you just created, drop user testuser@'localhost';. Thank you for reading! After reading the above, do you have a general understanding of MySQL's cases of adding accounts, granting permissions, and deleting users? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.
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.