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

Recommend

MySQL Series 13 MySQL Replication

Table of contents 1. MySQL replication related co...

HTML+CSS to create a top navigation bar menu

Navigation bar creation: Technical requirements: ...

Let the web page redirect to other pages after opening for a few seconds

Just add the following code to achieve it. Method ...

How to use Vue to implement CSS transitions and animations

Table of contents 1. The difference between trans...

Specific use of MySQL internal temporary tables

Table of contents UNION Table initialization Exec...

Vue-Element-Admin integrates its own interface to realize login jump

1. First look at the request configuration file, ...

How to expand the disk space of Linux server

Table of contents Preface step Preface Today I fo...

A brief talk about Mysql index and redis jump table

summary During the interview, when discussing abo...

How to configure Java environment variables in Linux system

Configure Java environment variables Here, the en...

Implementation of element input box automatically getting focus

When making a form in a recent project, I need to...

Detailed analysis of Vue child components and parent components

Table of contents 1. Parent components and child ...

js to realize the function of uploading pictures

The principle of uploading pictures on the front ...

The qualities and abilities a web designer should have

Web design is an emerging marginal industry that c...

Detailed explanation of the new features of ES9: Async iteration

Table of contents Asynchronous traversal Asynchro...