2019年10月21日 星期一

【MYSQL】記錄一次DBI connect(';;mysql_read_default_group=client','root',...) failed: Can't connect to local MySQL server through socket...報錯-版本5.7

[root@rosalie-mysql01 ~]# pt-duplicate-key-checker -u root -p1234 --database=tttt

DBI connect(';;mysql_read_default_group=client','root',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /usr/local/bin/pt-duplicate-key-checker line 894
顯示預設的sock路徑有誤,重新指定正確路徑即可,加入socket=路徑

加入紫色字段即可
[root@rosalie-mysql01 ~]# pt-duplicate-key-checker -u root -p1234 --database=tttt --socket=/tmp/mysql.sock
# ########################################################################
# tttt.test_index
# ########################################################################

# ID_2 is a duplicate of PRIMARY
# Key definitions:
# KEY `ID_2` (`ID`),
# PRIMARY KEY (`ID`),
# Column types:
# `id` int(11) not null
# To remove this duplicate index, execute:
ALTER TABLE `tttt`.`test_index` DROP INDEX `ID_2`;

# Uniqueness of ID ignored because PRIMARY is a duplicate constraint
# ID is a duplicate of PRIMARY
# Key definitions:
# UNIQUE KEY `ID` (`ID`),
# PRIMARY KEY (`ID`),
# Column types:
# `id` int(11) not null
# To remove this duplicate index, execute:
ALTER TABLE `tttt`.`test_index` DROP INDEX `ID`;

# B is a left-prefix of BCD
# Key definitions:
# KEY `B` (`B`),
# KEY `BCD` (`B`,`C`,`D`),
# Column types:
# `b` int(11) not null
# `c` int(11) not null
# `d` int(11) not null
# To remove this duplicate index, execute:
ALTER TABLE `tttt`.`test_index` DROP INDEX `B`;

# A is a left-prefix of ABC
# Key definitions:
# KEY `A` (`A`),
# KEY `ABC` (`A`,`B`,`C`),
# Column types:
# `a` int(11) not null
# `b` int(11) not null
# `c` int(11) not null
# To remove this duplicate index, execute:
ALTER TABLE `tttt`.`test_index` DROP INDEX `A`;

# ########################################################################
# Summary of indexes
# ########################################################################

# Size Duplicate Indexes 16
# Total Duplicate Indexes 4
# Total Indexes 8

沒有留言:

張貼留言

【MYSQL】MYSQL的SYS表說明(版本8.0)

mysql> use sys Reading table information for completion of table and column names You can turn off this feature to get a quicker s...