Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

25 total results found

Commands

MySQL Quick Start

Config Path mysql --help | grep -B 1 etc/my.cnf Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /opt/homebrew/etc/my.cnf ~/.my.cnf mysqldump With DB Creation User --databases mysqldump -hlocalhost -uroot -...

database
mysql
mysqldump
commands

Quick Count

MySQL Quick Start

使用最小覆盖索引 针对 InnoDB 表(几十万到几百万行)快速统计行数,可以有几个方法。下面按实用性和效率排序: 选择最窄的索引列(最好是整型或短列)进行扫描,不访问表数据页。 假设你有一个 updated_at 的索引: SELECT COUNT(updated_at) FROM cert; 优化器会用覆盖索引,只扫描索引页,比全表扫描快很多。 如果想强制使用: SELECT COUNT(updated_at) FROM cert USE INDEX (idx_updated_at); 注意:不...

database
mysql
count

pt-table-checksum

MySQL Tools

Installation apt-get -y install percona-toolkit Priviledges 目标库 GRANT SELECT ON foo.* TO 'pttable'@'%'; 校验结果库 GRANT CREATE, INSERT, UPDATE, DELETE ON percona.* TO 'pttable'@'%'; 其它权限 GRANT PROCESS, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'pttable'@...

database
mysql
pt-table

pt-table-sync

MySQL Tools

Usage Print Diff pt-table-sync \ --print \ --chunk-size=1000 \ h=master_host,P=3306,u=root,p=123456,D=mydb,t=mytable \ h=slave_host,P=3306,u=root,p=123456 Execute Diff pt-table-sync \ --execute \ --chunk-size=1000 \ h=master_host,P=3306,u=root,...

database
mysql
pt-table

Localhost/127/UnixSocket

MySQL Troubleshooting

question这是 MySQL 客户端的默认行为!当你在配置文件中指定 host=localhost 时,MySQL 客户端会自动尝试使用 Unix socket 连接,但如果 Unix socket 不可用或连接失败,它就会回退到 TCP 连接,并将 localhost 解析为 127.0.0.1。

database
mysql
troubleshooting