Tidb配置mysql_config_editor工具

Tidb配置mysql_config_editor工具

𝓓𝓸𝓷 Lv6

在tidb中安装mysql_config_editor插件,隐藏帐号密码
https://downloads.mysql.com/archives/community/
mysql client5.6版本以上自带mysql_config_editor

一、下载mysql client

1
2
3
4
5
6
7
8
9

https://downloads.mysql.com/archives/get/p/23/file/mysql-community-client-8.3.0-1.el7.x86_64.rpm

https://downloads.mysql.com/archives/get/p/23/file/mysql-community-libs-8.3.0-1.el7.x86_64.rpm

https://downloads.mysql.com/archives/get/p/23/file/mysql-community-client-plugins-8.3.0-1.el7.x86_64.rpm

https://downloads.mysql.com/archives/get/p/23/file/mysql-community-common-8.3.0-1.el7.x86_64.rpm

二、卸载mariadb

1
2
3
4
5
6
7

[root@localhost logs]# yum -y remove mari*

[root@localhost logs]# rm -rf /var/lib/mysql/*

[root@localhost logs]# rm -rf /etc/my.cnf

三、安装mysql client

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

[root@monitor ~]# ll mysql*
-rw-r--r-- 1 root root 17008176 Dec 15 2023 mysql-community-client-8.3.0-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 3623692 Dec 15 2023 mysql-community-client-plugins-8.3.0-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 698240 Dec 15 2023 mysql-community-common-8.3.0-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 1587092 Dec 15 2023 mysql-community-libs-8.3.0-1.el7.x86_64.rpm

[root@monitor ~]# rpm -ivh mysql*
warning: mysql-community-client-8.3.0-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-plugins-8.################################# [ 25%]
2:mysql-community-common-8.3.0-1.el################################# [ 50%]
3:mysql-community-libs-8.3.0-1.el7 ################################# [ 75%]
4:mysql-community-client-8.3.0-1.el################################# [100%]

[tidb@monitor ~]$ ll /bin/mysql*
-rwxr-xr-x 1 root root 7788840 Dec 15 2023 /bin/mysql
-rwxr-xr-x 1 root root 7461896 Dec 15 2023 /bin/mysqladmin
-rwxr-xr-x 1 root root 8136168 Dec 15 2023 /bin/mysqlbinlog
-rwxr-xr-x 1 root root 7467040 Dec 15 2023 /bin/mysqlcheck
-rwxr-xr-x 1 root root 6575072 Dec 15 2023 /bin/mysql_config_editor
-rwxr-xr-x 1 root root 7548336 Dec 15 2023 /bin/mysqldump
-rwxr-xr-x 1 root root 7454392 Dec 15 2023 /bin/mysqlimport
-rwxr-xr-x 1 root root 7546432 Dec 15 2023 /bin/mysql_migrate_keyring
-rwxr-xr-x 1 root root 8096008 Dec 15 2023 /bin/mysqlpump
-rwxr-xr-x 1 root root 7452424 Dec 15 2023 /bin/mysqlshow
-rwxr-xr-x 1 root root 7472064 Dec 15 2023 /bin/mysqlslap

四、配置mysql_config_editor

1.创建配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[tidb@monitor ~]$ mysql_config_editor set --login-path=tidb --user=root --password --host=192.168.1.181 --port=4000
Enter password:

也可以简写:
[root@mysql mysql]# mysql_config_editor set -G tidb -u root -p -h 192.168.1.181 -P 4000

免输密码登录:
[tidb@monitor ~]$ mysql --login-path=tidb
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 211812362
Server version: 8.0.11-TiDB-v8.3.0 TiDB Server (Apache License 2.0) Community Edition, MySQL 8.0 compatible

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

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>

2.查看配置
1
2
3
4
5
6
[tidb@monitor ~]$ mysql_config_editor print --all
[tidb]
user = "root"
password = *****
host = "192.168.1.181"
port = 4000
3.删除配置
1
[tidb@monitor ~]$ mysql_config_editor remove -G tidb
4.清空配置
1
[tidb@monitor ~]$ mysql_config_editor reset
  • Title: Tidb配置mysql_config_editor工具
  • Author: 𝓓𝓸𝓷
  • Created at : 2024-12-26 17:50:45
  • Updated at : 2024-12-30 10:47:02
  • Link: https://www.zhangdong.me/tidb-mysql-config-editor-tools.html
  • License: This work is licensed under CC BY-NC-SA 4.0.
评论