在TDSQL 集群中,执行命令报如下错误:
[dave@www.cndba.cn percona-5.7.17]# mysql -htdsql1 -udave -pdave -P4008
Welcome to the MariaDB monitor. Commands end with ; or /g.
Your MySQL connection id is 208865
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)]>
MySQL [(none)]> change master to master_host='192.168.31.61',master_port=4002,master_user='slave',master_password='slave',master_log_file='binlog.000002',master_log_pos=40516258;
ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER privilege(s) for this operation
MySQL [(none)]>
实际上类似的权限问题在赋权一块也有问题,参考之前的博客:
TDSQL集群 数据库 命令行 创建用户失败 说明
https://www.cndba.cn/dave/article/4635
这里的解决方法就是使用jmysql.sh 来执行相关的命令,该工具默认使用超级管理员权限登陆,所以可以执行相应的命令:
[dave@www.cndba.cn install]# pwd
/data/tdsql_run/4008/percona-5.7.17/install
[dave@www.cndba.cn install]# ./jmysql.sh 4008
cmd: e
/data1/tdengine/data/4008/prod/mysql.sock
/data/tdsql_run/4008/percona-5.7.17
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 211048
Server version: 5.7.17-11-V2.0R540D002-20191226-1152-log Source distribution
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
mysql> change master to master_host='192.168.31.61',master_port=4002,master_user='slave',master_password='slave',master_log_file='binlog.000002',master_log_pos=40516258;
Query OK, 0 rows affected, 2 warnings (0.13 sec)
mysql>
但是这个命令要慎重使用。 比如我们之前说的创建用户并赋权,直接在mysql 客户端执行会报错,在jmysql.sh 中就可以成功执行,但会导致创建的用户信息无法写入到zk中,而在赤兔中创建的用户是可以写入到zk的:
[dave@www.cndba.cn install]# ./jmysql.sh 4008
cmd: e
/data1/tdengine/data/4008/prod/mysql.sock
/data/tdsql_run/4008/percona-5.7.17
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 211048
Server version: 5.7.17-11-V2.0R540D002-20191226-1152-log Source distribution
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
mysql> grant replication slave on *.* to 'ustc'@'%' identified by 'ustc';
Query OK, 0 rows affected, 1 warning (0.02 sec)
mysql> show grants for 'ustc'%'%';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%'%'' at line 1
mysql> show grants for 'ustc'@'%';
+----------------------------------------------+
| Grants for ustc@% |
+----------------------------------------------+
| GRANT REPLICATION SLAVE ON *.* TO 'ustc'@'%' |
+----------------------------------------------+
1 row in set (0.02 sec)
mysql>
版权声明:本文为博主原创文章,未经博主允许不得转载。