0

我有一个全新的安装(测试)数据库机器正在运行Centos8percona-server带有 mysql8。

这是我第一次使用percona-toolkitmysql8。没有任何工作。对 5.7 的旧pt-online-schema-change调用不再起作用。即使是简单的事情也会失败:

pt-online-schema-change --alter-foreign-keys-method=auto --dry-run --print --alter "ADD column marketplace22 varchar(25)"  D=app_production,t=sales_ranks

结果是:

(in cleanup) Error altering new table `app_production`.`_sales_ranks_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 ' ' at line 1 [for Statement "ALTER TABLE `app_production`.`_sales_ranks_new` add column marketplace22 varchar(25) "] at /usr/bin/pt-online-schema-change line 9512.

如果我在 mysql 提示符内执行代码,它就可以工作......所以它是关于配置的,但实际上它应该是自动的。

完整通话

[root@centos-db-test ~]# pt-online-schema-change  --user=root --ask-pass --alter-foreign-keys-method=auto --execute --print --alter "add column marketplace22 varchar(25)"  D=app_production,t=sales_ranks
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Enter MySQL password: 
No slaves found.  See --recursion-method if host centos-db-test has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
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
Child tables:
  `app_production`.`sales_rank_data_points` (approx. 1 rows)
Will automatically choose the method to update foreign keys.
Altering `app_production`.`sales_ranks`...
Creating new table...
CREATE TABLE `app_production`.`_sales_ranks_new` (
  `id` int NOT NULL AUTO_INCREMENT,
  `product_category` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `rank` int DEFAULT NULL,
  `item_id` int DEFAULT NULL,
  `tenant_id` int DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `marketplace` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `marketplace22` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `index_sales_ranks_on_item_id` (`item_id`) USING BTREE,
  KEY `index_sales_ranks_on_tenant_id` (`tenant_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8203494 DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPRESSED
Created new table app_production._sales_ranks_new OK.
Altering new table...
ALTER TABLE `app_production`.`_sales_ranks_new` add column marketplace22 varchar(25) 
2021-07-29T07:20:00 Dropping new table...
DROP TABLE IF EXISTS `app_production`.`_sales_ranks_new`;
2021-07-29T07:20:00 Dropped new table OK.
`app_production`.`sales_ranks` was not altered.
    (in cleanup) Error altering new table `app_production`.`_sales_ranks_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 ' ' at line 1 [for Statement "ALTER TABLE `app_production`.`_sales_ranks_new` add column marketplace22 varchar(25) "] at /usr/bin/pt-online-schema-change line 9512.

Error altering new table `app_production`.`_sales_ranks_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 ' ' at line 1 [for Statement "ALTER TABLE `app_production`.`_sales_ranks_new` add column marketplace22 varchar(25) "] at /usr/bin/pt-online-schema-change line 9512.
4

0 回答 0