Detailed explanation of the solution to the error in creating a user and granting permissions in mysql8.0

Detailed explanation of the solution to the error in creating a user and granting permissions in mysql8.0

Question 1:

The writing method that will report an error:

GRANT ALL PRIVILEGES ON *.* 'root'@'%' identified by '123123' WITH GRANT OPTION;

The following is the correct way to write it:

grant all privileges on *.* to 'root'@'%';

It can be seen that the authorization statement needs to be removed

IDENTIFIED BY 'password';

How to grant a certain permission separately:

GRANT SELECT 
ON oilsystem.input 
TO 'u5'@'localhost'

Refresh permissions and view how permissions are written:

FLUSH PRIVILEGES; 
select * from user;

Note: You need to add a sentence before creating a user

Use mysql;

In addition, the way to revoke a certain permission is:

REVOKE select 
ON . 


FROM 'u1'@'localhost';

Question 2:

Mysql remote connection error: authentication plugin caching_sha2

MySQL 8.0 uses the caching_sha2_password authentication mechanism by default - changing from mysql_native_password to caching_sha2_password.

Upgrading from 5.7 to 8.0 will not change the authentication method for existing users, but new users will use the new caching_sha2_password by default.

The client does not support the new encryption method.

Method 1: Change the user's password and encryption method

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

New feature of mysql8.*: caching_sha2_password password encryption method

Previous versions of MySQL used mysql_native_password for password encryption.

The default caching_sha2_password for newly added user passwords is

If you upgrade based on the previous MySQL, the password encryption used by the user must be mysql_native_password

If you use the previous password encryption method, modify the file /etc/my.cnf. Finally: I also stepped on countless pits before the deployment was successful.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • 4 solutions to mysql import csv errors
  • Problems and solutions of error 08001 when linking to MySQL in IDEA and no table display after successful connection
  • Problems and solutions for IDEA connecting to MySQL
  • Solution to the problem that synchronous replication errors cannot be skipped in MySQL5.6 GTID mode
  • Solution to ONLY_FULL_GROUP_BY error in Mysql5.7 and above
  • MySQL Error 1290 (HY000) Solution
  • Django restarts after reinstalling MySQL and reports an error: How to solve the problem of No module named 'MySQLdb'
  • Solution to the error message "java.sql.SQLException: Incorrect string value:'\xF0\x9F\x92\xA9\x0D\x0A...'" when storing emoticons in MySQL
  • Description and solution of MySQLdb error when installing Python
  • How to solve the error when connecting to MySQL in Linux: Access denied for user 'root'@'localhost'(using password: YES)
  • Teach you how to solve the error when storing Chinese characters in MySQL database

<<:  Win10 installation Linux system tutorial diagram

>>:  Vue2 implements provide inject to deliver responsiveness

Recommend

Split and merge tables in HTML (colspan, rowspan)

The code demonstrates horizontal merging: <!DO...

Essential knowledge for web development interviews and written tests (must read)

The difference between inline elements and block-...

Tomcat8 uses cronolog to split Catalina.Out logs

background If the catalina.out log file generated...

MySQL server 5.7.20 installation and configuration method graphic tutorial

This article records the installation and configu...

5 cool and practical HTML tags and attributes introduction

In fact, this is also a clickbait title, and it c...

mysql8.0.23 linux (centos7) installation complete and detailed tutorial

Table of contents What is a relational database? ...

Window.name solves the problem of cross-domain data transmission

<br />Original text: http://research.microso...

Vue uniapp realizes the segmenter effect

This article shares the specific code of vue unia...

Docker case analysis: Building a MySQL database service

Table of contents 1 Create configuration and data...

MySQL 8.0.21 installation tutorial under Windows system (illustration and text)

Installation suggestion : Try not to use .exe for...

Analyze Mysql transactions and data consistency processing issues

This article analyzes the consistency processing ...

Detailed Example of JavaScript Array Methods

Table of contents Introduction Creating an Array ...

Summary of examples of common methods of JavaScript arrays

Table of contents Common array methods concat() M...

Develop calculator example code using native javascript

The main function of a calculator is to perform n...

Detailed explanation of how to configure static IP in Centos8

After installing centos 8, the following error wi...