一、实验环境

# systemctl status mysqld

【MySQL】关于MySQL的root用户授权

# cat /etc/systemd/system/mysqld.service

 

【MySQL】关于MySQL的root用户授权

 

# cat /opt/mysqlconfig/mysqld.cnf

【MySQL】关于MySQL的root用户授权

二、问题背景

 

mysql> CREATE DATABASE IF NOT EXISTS test DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

mysql>  grant all privileges on test.* to 'test_user'@'%' IDENTIFIED BY '[email protected]';

报错:1044 - Access denied for user 'root'@'%' to database 'test'

【MySQL】关于MySQL的root用户授权

 

三、问题解决

# docker ps | grep mysql

 

【MySQL】关于MySQL的root用户授权

# docker exec -it mysql mysql -u root -p"[email protected]"

【MySQL】关于MySQL的root用户授权

【MySQL】关于MySQL的root用户授权

mysql> select user,host from mysql.user;

 

【MySQL】关于MySQL的root用户授权

mysql> show grants for [email protected]'%';

mysql> show grants for [email protected]'localhost';

 

【MySQL】关于MySQL的root用户授权

 

【MySQL】关于MySQL的root用户授权

【MySQL】关于MySQL的root用户授权

 

 

【MySQL】关于MySQL的root用户授权

 

【MySQL】关于MySQL的root用户授权

相关文章:

  • 2021-07-14
  • 2022-12-23
  • 2021-11-02
  • 2022-01-07
  • 2021-09-04
  • 2021-10-21
  • 2022-02-04
猜你喜欢
  • 2021-08-11
  • 2021-05-15
  • 2021-10-07
  • 2021-05-19
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
相关资源
相似解决方案