这里收藏工作中用到的脚本,也为了防止做重复的搜索工作,同时分享给大家。
查看当前表的自增序列
1 | SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'DatabaseName' AND TABLE_NAME = 'TableName'; |
修改自增序列
1 | alter table tablename auto_increment=NUMBER; |
查看binlog
1 | show binary logs; |
查看binlog位置
1 | show binlog events in '${BINLOG}' limit 10; |
批量更新指定schema的increment
1 | !/bin/bash |
批量导出数据库(除了系统库)
1 | echo "show databases" | mysql | grep -Ev "^(Database|mysql|performance_schema|information_schema)$" > databases |