MySQL
Quick Start
Commands
Config Path mysql --help | grep -B 1 etc/my.cnf Default options are read from the following fil...
binlog
Show Variables SHOW VARIABLES LIKE 'log_bin'; +---------------+-------+ | Variable_name | Value...
Installation
MySQL Client 到 Oracle 官方 MySQL APT repo 下载配置包(最新版在 2025 之前是 0.8.33 这一支): wget https://dev.mysql....
Quick Count
使用最小覆盖索引 针对 InnoDB 表(几十万到几百万行)快速统计行数,可以有几个方法。下面按实用性和效率排序: 选择最窄的索引列(最好是整型或短列)进行扫描,不访问表数据页。 假设你有一...
Replica
Grant User CREATE USER 'repl'@'%' IDENTIFIED BY '123'; GRANT REPLICATION SLAVE, REPLICATION CLI...
Tools
MyDumper
https://mydumper.github.io/mydumper/docs/html/index.html Installation macOS brew install mydumper
pt-table-checksum
Installation apt-get -y install percona-toolkit Priviledges 目标库 GRANT SELECT ON foo.* TO 'pttab...
pt-table-sync
Usage Print Diff pt-table-sync \ --print \ --chunk-size=1000 \ h=master_host,P=3306,u=root...
Troubleshooting
Deadlock
mysql 5.7 查看事务的阻塞关系 SELECT r.trx_id waiting_trx_id, r.trx_mysql_thread_id waiting_thre...
Kylin OOM
解决Kylin V10 下 MySQL 容器内存占用异常的问题,参考文档https://zhuanlan.zhihu.com/p/679582049?utm_medium=social&utm_...
Communication Errors
Background ✅ MySQL can connect from its own pod. ❌ MySQL can't connect by K8s service. Service...
Localhost/127/UnixSocket
question这是 MySQL 客户端的默认行为!当你在配置文件中指定 host=localhost 时,MySQL 客户端会自动尝试使用 Unix socket 连接,但如果 Unix s...