在TDSQL 集群中创建用户报错:
[dave@www.cndba.cn percona-5.7.17]# mysql -htdsql1 -udave -pdave -P4002
Welcome to the MariaDB monitor. Commands end with ; or /g.
Your MySQL connection id is 203759
Server version: 5.7.17-11-V2.0R540D002-20191226-1152-log Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
MySQL [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MySQL [mysql]>
MySQL [mysql]> grant replication slave on *.* to slave@'%' identified by 'slave';
ERROR 1045 (28000): Access denied for user 'dave'@'%' (using password: YES)
MySQL [mysql]> create user slave identified by 'slave';
Query OK, 0 rows affected (0.07 sec)
MySQL [mysql]> GRANT REPLICATION SLAVE ON *.* TO 'slave'@'%';
ERROR 1045 (28000): Access denied for user 'dave'@'%' (using password: YES)
MySQL [mysql]> drop user slave;
Query OK, 0 rows affected (0.09 sec)
MySQL [mysql]> select host,user from user;
+-----------+--------------+
| host | user |
+-----------+--------------+
| % | CHITUDMSUSER |
| % | dave |
| localhost | mysql.sys |
+-----------+--------------+
3 rows in set (0.00 sec)
MySQL [mysql]> show grants for 'mysql.sys'@'localhost';
+---------------------------------------------------------------+
| Grants for mysql.sys@localhost |
+---------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'mysql.sys'@'localhost' |
| GRANT TRIGGER ON `sys`.* TO 'mysql.sys'@'localhost' |
| GRANT SELECT ON `sys`.`sys_config` TO 'mysql.sys'@'localhost' |
+---------------------------------------------------------------+
3 rows in set (0.00 sec)
MySQL [mysql]> show grants for 'dave'@'%';
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for dave@% |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON *.* TO 'dave'@'%' |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
MySQL [mysql]>
一查看,原来是权限不足,首先在TDSQL 数据库中没有root用户,第二创建的用户没有WITH GRANT OPTION, 所以我们grant 命令执行失败了。
但是可以在赤兔平台里创建好用户并赋权:
[dave@www.cndba.cn percona-5.7.17]# mysql -htdsql1 -udave -pdave -P4002
Welcome to the MariaDB monitor. Commands end with ; or /g.
Your MySQL connection id is 203759
Server version: 5.7.17-11-V2.0R540D002-20191226-1152-log Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
MySQL [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MySQL [mysql]>
MySQL [mysql]> show grants for 'slave'@'%';
+-----------------------------------------------+
| Grants for slave@% |
+-----------------------------------------------+
| GRANT REPLICATION SLAVE ON *.* TO 'slave'@'%' |
+-----------------------------------------------+
1 row in set (0.04 sec)
MySQL [mysql]>
所以这里应该是TDSQL 在用户权限方面的一个管理措施,就是让用户创建和赋权都在赤兔平台里进行,命令行无法进行权限的修改。
版权声明:本文为博主原创文章,未经博主允许不得转载。