mysqldump 导出数据

  1. mysqldump -h x.x.x.x -u root -p dbname > db.sql;

错误提示

  1. Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events.
  2. mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"') FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'statdb' AND TABLE_NAME = 'wework_department';': Unknown table 'COLUMN_STATISTICS' in information_schema (1109)
  1. mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"') FROM information_schema.COLUMN_STATISTICS

解决方法

  1. mysqldump --column-statistics=0 -h x.x.x.x -u root -p dbname > db.sql;

原因

这是因为新版的mysqldump默认启用了一个新标志,通过—column-statistics=0来禁用他。