Mysql dump and restore on windows

Dump

cd c:\program files\mariadb 10.4\bin

mysqldump -uroot -p –-all-databases > c:\backup\local_db\20210123.sql

Note:

  • Execute this command in “command promp” not in “mysql client”
  • No “;” in the end!

Restore

mysql -u username -p dbname < c:\backup\local_db\20210123.sql

mysql -u root -p < c:\backup\local_db\20210123.sql

Reference:

  1. https://john-dugan.com/dump-and-restore-mysql-databases-in-windows/
  2. https://code.yidas.com/mysqldump/