在docker中备份mysql的方法

docker exec  mysql sh -c "mysqldump -u root -p${password}. ${dbname} ${tablename}" > /path/xxx.sql

mysql可以是mysql容器的名称或者id