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

How to create a read-only user in mysql

coldplay.xixi
Release: 2020-10-10 16:06:12
Original
10489 people have browsed it

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
Copy after login

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";
Copy after login

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

flush privileges;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template