Home >Database >Mysql Tutorial >How to create a read-only user in mysql

How to create a read-only user in mysql

coldplay.xixi
coldplay.xixiOriginal
2020-10-10 16:06:1210541browse

Mysql method to add read-only users: 1. Use the existing root user to log in to Mysql; 2. Create a user and authorize SELECT query permissions and remote access permissions; 3. Refresh mysql permissions to enable the user Creation and authorization take effect.

How to create a read-only user in mysql

Mysql method to add a read-only user:

1. Log in to Mysql using the existing root user.

mysql -uroot -p

2. Create a user and authorize SELECT query permissions and remote access permissions. Note that username/password in the command refers to the username and password, please specify it yourself. If you want to restrict only the specified IP to use this user to access Mysql, change % to a specific IP.

GRANT SElECT ON *.* TO 'username'@'%' IDENTIFIED BY "password";

3. Refresh mysql permissions to make user creation and authorization effective.

flush privileges;

Related free learning recommendations: mysql database (video)

The above is the detailed content of How to create a read-only user in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn