On my centos host, running mysql command through docker exec is hung forever:
$ docker exec mysql /usr/bin/mysql -u root --password=passwd123 < mysql.backup.sql
The mysql DB is accessible using mysqlworkbench just fine.
Thanks for your help.
On my centos host, running mysql command through docker exec is hung forever:
$ docker exec mysql /usr/bin/mysql -u root --password=passwd123 < mysql.backup.sql
The mysql DB is accessible using mysqlworkbench just fine.
Thanks for your help.
2
Answers
I was missing -i parameter in my original command.
This command works perfectly:
You can try following for backup
docker exec mysql /usr/bin/mysqldump -u root --password=passwd123 DATABASE > backup.sql
Instead of mysql you should use mysqldump ( Mysqldump is a command-line utility that is used to generate the logical backup of the MySQL database. )
If your purpose is restore, then
cat backup.sql | docker exec -i mysql /usr/bin/mysql -u root --password=passwd123 DATABASE