mysql - Percona pt-online-schema-change 无法更改表

标签 mysql percona

我正在尝试使用pt-online-schema-change来更改表中的数据大小。我正在尝试将 name 列增加到 varchar(30)

pt-online-schema-change D=clients,t=client_types --alter "CHANGE `name` `name` varchar(30)" --dry-run;

我收到一些错误。

-bash: name: command not found

然后看起来命令执行了但最终失败了。

Operation, tries, wait:
analyze_table, 10, 1
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_foreign_keys, 10, 1
Starting a dry run.  `clients`.`client_types` will not be altered.  Specify --execute instead of --dry-run to alter the table.
Creating new table...
Created new table clients._client_types_new OK.
Altering new table...
2019-10-08T13:43:40 Dropping new table...
2019-10-08T13:43:40 Dropped new table OK.
Dry run complete.  `clients`.`client_types` was not altered.
Error altering new table `clients`.`_client_types_new`: DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varchar(30)' at line 1 [for Statement "ALTER TABLE `clients`.`_client_types_new` CHANGE   varchar(30)"] at /usr/bin/pt-online-schema-change line 9194.

我正在使用mysql Ver 14.14

最佳答案

这解决了我的问题。 pt-online-schema-change --dry-run --alter "修改名称 varchar(30)"D=client,t=client_types;

关于mysql - Percona pt-online-schema-change 无法更改表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58291640/

相关文章:

php - 使用php从数据库中检索一个整数值

mysql - 应用程序因 MySQL 服务器负载过重而宕机

mysql - 我怎么知道是否安装了 percona

mysql - 通过 Percona 工具包运行 Flyway 迁移

php - 数组中的复选框没有值

php - 防止不同用户同时进行多个投票

php - MySql如何在1个查询中选择具有2个不同where条件的总和列

php - MySQL5.6 vs Percona 5.7 隐式转换问题

mysql - "SHOW ERRORS"在存储过程中不起作用(Percona Server 5.6.26-74.0)

mysql - 将表 1 中的一列左连接到表 2 中的两列