apecloud / myduckserver

MySQL & Postgres Analytics, Reimagined
184 stars 8 forks source link

Support mysqlsh -- load-dump/copy-instance #96

Closed fanyang01 closed 1 month ago

fanyang01 commented 1 month ago

Resolves #94

Copy a MySQL instance

# Create an admin user in MyDuckServer
mysql -h127.0.0.1 -uroot -P3306 <<EOF
CREATE USER 'admin'@'%' IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%';
SET GLOBAL local_infile = 1;
EOF

# Copy an existing MySQL instance to MyDuckServer
mysqlsh -h127.0.0.1 -P13310 -uroot -proot -- util copy-instance \
    'mysql://admin:admin@127.0.0.1:3306' \
    --exclude-users root \
    --ignore-existing-objects true \
    --handle-grant-errors ignore

Load a MySQL dump

# Dump a MySQL instance
mysqlsh -h127.0.0.1 -P13310 -uroot -proot -- util dump-instance ./my-sh-dump
# Load the dump into MyDuckServer
mysqlsh -h127.0.0.1 -P3306 -uroot --no-password -- util load-dump ./my-sh-dump