MySQL 8.0.18 adds users to the database and grants permissions

MySQL 8.0.18 adds users to the database and grants permissions

1. It is preferred to use the root user to log in to the database

mysql -uroot -p

2. Using MySQL database

USE mysql;

3. Create a user for mysql: dev Password: dev12345

CREATE USER dev IDENTIFIED BY 'dev12345';

4. Check the permissions of user dev

SELECT * FROM user WHERE user='dev';
SHOW GRANTS FOR dev;

5. Assign EXECUTE (execute stored procedure), INSERT, SELECT, and UPDATE permissions to user dev on the database named dev_db. @'%' means that this database can be accessed from any IP address.

GRANT EXECUTE,INSERT,SELECT,UPDATE ON dev_db.* TO 'dev'@'%';
FLUSH PRIVILEGES;

6. Query the permissions again

SELECT * FROM USER WHERE USER='dev_dv';
SHOW GRANTS FOR dev;

Summarize

The above is what I introduced to you about adding users and granting permissions to the database in MySQL 8.0.18. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • mysql create database, add users, user authorization practical method
  • MySql installation and configuration method (MySQL add users, delete users and authorization)
  • Specific implementation of adding users and assigning permissions to MySQL database
  • MYSQL basics: connect to MYSQL, change password, add user
  • Introduction to adding new users to MySql, creating databases for users, and assigning permissions to users

<<:  Detailed explanation of script debugging mechanism in bash

>>:  The vue configuration file automatically generates routing and menu instance code

Blog    

Recommend

How to implement Docker container self-start

Container auto-start Docker provides a restart po...

Detailed steps for using jib for docker deployment in Spring Cloud

Introduction to Jib Jib is a library developed by...

A brief analysis of the use of the HTML webpack plugin

Using the html-webpack-plugin plug-in to start th...

JavaScript Shorthand Tips

Table of contents 1. Merge arrays 2. Merge arrays...

Ideas and codes for implementing Vuex data persistence

What is vuex vuex: is a state manager developed s...

How to get the real path of the current script in Linux

1. Get the real path of the current script: #!/bi...

Detailed tutorial on downloading mysql on Windows 10

MySQL versions are divided into Enterprise Editio...

Detailed explanation of the principle and usage of MySQL stored procedures

This article uses examples to explain the princip...

Several ways to encapsulate axios in Vue

Table of contents Basic Edition Step 1: Configure...

Encoding problems and solutions when mysql associates two tables

When Mysql associates two tables, an error messag...

JavaScript to achieve fireworks effects (object-oriented)

This article shares the specific code for JavaScr...

Solution to the ineffective global style of the mini program custom component

Table of contents Too long to read Component styl...

MySQL database SELECT query expression analysis

A large part of data management is searching, and...

mysql 5.7.18 winx64 free installation configuration method

1. Download 2. Decompression 3. Add the path envi...