You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I didn't know that we can use mysqldump to restore/import a MySQL database. I could not find anything in the official docs, just some rare answers on stack overflow.
In my tests the mysqldumpcommand gets executed without any errors, but it does nothing with the database. Maybe it works with a different version, I use the one from MariaDB.
Code
public function getDefaultRestoreCommand(): string
{
return 'mysqldump'.
' --defaults-extra-file="'.$this->_createDumpConfigFile().'"'.
' {database}'.
' < "{file}"';
}
Fix
In my opinion it should be mysql {database} < {file} instead of mysqldump {database} < {file}.
Description
I didn't know that we can use
mysqldump
to restore/import a MySQL database. I could not find anything in the official docs, just some rare answers on stack overflow.In my tests the
mysqldump
command gets executed without any errors, but it does nothing with the database. Maybe it works with a different version, I use the one from MariaDB.Code
Fix
In my opinion it should be
mysql {database} < {file}
instead ofmysqldump {database} < {file}
.Steps to reproduce
\Craft::$app->getDb()->backupTo('path/to/dump.sql');
\Craft::$app->getDb()->restore('path/to/dump.sql');
Additional info
The text was updated successfully, but these errors were encountered: