Importing or restoring a database backup can lead to potential data loss, as small mistakes can result in loss of important information without the ability to recover recent changes.
When you want to import a dump of your live/production environment into the staging environment, you may encounter an error like this:
ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER privilege(s) for this operation
This is due to references in your database name or live account name. This can be resolved by using a script we provide:
~/bin/fix_db_export.sh <file.sql.gz>
This works regardless of whether you're working with Magento or Shopware, but it may require additional steps.
In the examples below, replace <username_dbname> by your SSH username followed by an underscore and the name of your application. For example, coolsitest_magento or blogrc_wordpress could be used.
Create database:
mysql '' --execute='CREATE DATABASE <username_dbname>;'
Example:
zcat ~/backup/db_backup.sql.gz | mysql <username_dbname>
This requires a working Magento configuration file ~/httpdocs/app/etc/local.xml:
n98-magerun db:import --compression=gzip ~/backup/db_backup.sql.gz
This requires a working Magento configuration file ~/magento2/app/etc/env.php:
n98-magerun2 db:import --compression=gzip ~/backup/db_backup.sql.gz
Was dit artikel nuttig?
Dat is fantastisch!
Hartelijk dank voor uw beoordeling
Sorry dat we u niet konden helpen
Hartelijk dank voor uw beoordeling
Feedback verzonden
We stellen uw moeite op prijs en zullen proberen het artikel te verbeteren