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.
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!