Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql to create users and ssc website Construction

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

There are three ways for mysql to create users: ssc website construction [enterprise E: 1793], INSERT USER table method, CREATE USER method, GRANT method.

1. Create a user through the CREATE USER command

Script: CREATE USER 'username'@'host' [IDENTIFIED BY' PASSWORD'] where the password is optional

Example: CREATE USER 'test'@'127.0.0.1' IDENTIFIED BY "123"

CREATE USER 'test'@'127.0.0.%' IDENTIFIED BY "123"

CREATE USER 'test'@'%'

Description: the user created by this method only has the right to connect to the database and needs to be authorized later.

2. Create a user through the GRANT command

Personal habits generally use this method to create users. When there is a user in the database, GRANT will authorize the user, but when the user does not exist in the database, it will create

The corresponding user is authorized. (indicating that the above step is superfluous)

Script:

GRANT ON [object] [IDENTIFIED BY 'password']

[WITH GRANT OPTION]

MAX_QUERIES_PER_HOUR count

MAX_UPDATES_PER_HOUR count

MAX_CONNECTIONS_PER_HOUR count

MAX_USER_CONNECTIONS count

Description: priv stands for permissions, select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file and other 14 permissions

Example: mysql > grant select,insert,update,delete,create,drop on test.hr to test@127.0.0.1 identified by '123'

Description: assign the user test whose host is 127.0.0.1 to select,insert,update,delete,create,drop and other operations on the hr table of the database test, and set the password

It's 123.

Mysql > grant all privileges on test. To test@127.0.0.1 identified by '123'

Note: assign the user test with host 127.0.0.1 to perform all operations on all tables in the database test, and set the password to 123.

Mysql > grant all privileges on. To test@127.0.0.1 identified by '123'

Note: assign the user test with host 127.0.0.1 to perform all operations on all tables in all databases, and set the password to 123.

Mysql > grant all privileges on. * to test@127.0.0.1 identified by '123'

Description: user test assigns permissions to perform all operations on all tables in all databases and sets the password to 123.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report