Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: user privilege check should be compatible with mysql 5.7 #12501

Closed
StrikeW opened this issue Sep 23, 2023 · 1 comment
Closed

Bug: user privilege check should be compatible with mysql 5.7 #12501

StrikeW opened this issue Sep 23, 2023 · 1 comment
Milestone

Comments

@StrikeW
Copy link
Contributor

StrikeW commented Sep 23, 2023

It seems to be because of the mysql version.

mysql> SELECT VERSION();
+------------+
| VERSION()  |
+------------+
| 5.7.36-log |
+------------+

I also tested mysql 5.7 with a new created user bob and grant all to the bob.

mysql> CREATE USER 'bob'@'%' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'bob'@'%';
Query OK, 0 rows affected (0.01 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> SHOW GRANTS FOR 'bob';
+------------------------------------------+
| Grants for bob@%                         |
+------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'bob'@'%' |
+------------------------------------------+
1 row in set (0.00 sec)

mysql -h 10.8.16.9 -P 3306 -u bob -ppassword

mysql> show grants;
+------------------------------------------+
| Grants for bob@%                         |
+------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'bob'@'%' |
+------------------------------------------+

mysql> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+-------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000044 |     4818 |              |                  |                   |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

So maybe consider compatibility with mysql 5.7?

Originally posted by @jho-yf in #12479 (comment)

@StrikeW
Copy link
Contributor Author

StrikeW commented Nov 6, 2023

The GRANT ALL in MySQL 5.7 is ambiguous, we should suggest user to grant required privileges explicitly via the following command:

GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'user'@'%';

@StrikeW StrikeW closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant