polardbx-sql icon indicating copy to clipboard operation
polardbx-sql copied to clipboard

can not dump all database by mysqldump

Open yejr opened this issue 2 years ago • 3 comments
trafficstars

polardb-x cluster was created via:

$ pxd tryout -cn_replica 2 -cn_version latest -dn_replica 2 -dn_version latest -cdc_replica 2 -cdc_version latest

dump data by mysqldump

$ mysqldump -t -n -h127.0.0.1 -P58709 -upolardbx_root -pxx --all-databases --triggers --routines --events | grep -c INSERT
0
$ mysqldump -t -n -h127.0.0.1 -P58709 -upolardbx_root -pxx -B d1 d2 d3 | grep -c INSERT
4

yejr avatar Nov 30 '22 01:11 yejr

@yejr can you provide some exception stack ?

hustfxj avatar Dec 01 '22 01:12 hustfxj

@yejr can you provide some exception stack ?

How can i get the exception stack?

When i ran mysqldump, there are no errers reported, and also no exception stack.

yejr avatar Dec 01 '22 02:12 yejr

According to mysqldump.cc#dump_all_databases, while dumping all databases, mysqldump client will find a database named mysql (the built-in System Schema) before dumping other databases. image However, the mysql schema does not exist in PolarDB-X, which leads to the empty output of mysqldump client.

Solution:

  1. Solution-1: Create an empty database named mysql in PolarDB-X image

  2. Solution-2: Instead of using the --all-databases option, just specify the target databases in the command line.

F-ca7 avatar Dec 01 '22 04:12 F-ca7