tl;dr: with the new stored procedures and triggers introduced to your database by this addon, you will need to ensure backups are made with the mysqldump "-R" option (or equivalent in your backup system to include procedures, functions and triggers), and you may need to massage the dump if you need to import it into a database using a different username. If you are backing up and restoring to the same database (e.g. a backup of your live shop) you should still ensure you include stored procedures and functions in your backup, an option that may not be enabled by default in your system.
When importing a backup created via something like mysqldump you may see this error message:
Code:
ERROR 1227 (42000) at line 96: Access denied; you need (at least one of) the SUPER, SET USER privilege(s) for this operation
The problem is probably "DEFINER" lines in the dumped SQL related to the triggers from this addon file which cause errors during import. Exactly how you can get around this depend on exactly how you are creating your export file (what backup tool or command you're using), and the environment you are importing it in (what command line tools you have available).
You should ensure you use the "-R" switch (or equivalent) when backing up your database:
Code:
$ # On one machine (probably live)
$ mysqldump -R my_zen_database products products_description > backup.sql
$ # On another machine with different username
$ mysql my_other_zen_database < backup.sql
I found the backup will contain the username of the original `mysqldump` command, e.g.:
Code:
/*!50003 CREATE*/ /*!50017 DEFINER=`live_username`@`localhost`*/ /*!50003 TRIGGER soundex_prod_desc_update
When this SQL is executed against your target database it will probably fail because the user `live_username` does not exist in that database, and you get the above error message. mysqldump does not appear to have any options that can make the dumped SQL file friendly. From searching online, there is a mysqlpump command shipped with MySQL that has a `--skip-definer` option but I'm using MariaDB which does not appear to have this tool (see https://jira.mariadb.org/browse/MDEV-12808)
The fix is to either change the DEFINER line to use your local username, or remove the DEFINER clause entirely.
To change the clause: s/DEFINER=`live_username`/DEFINER=`local_username`/
To remove the clause: s/\/\*!\d* DEFINER=[^*]*\*\///
For stored procedures, the dump will contain the DEFINER username for stored procedures:
Code:
CREATE DEFINER=`live_username`@`localhost` PROCEDURE `soundex_search_init_for_value`(
Here we again need to either change the username, or remove the DEFINER line entirely.
To change the clause (same as above): s/DEFINER=`live_username`/DEFINER=`local_username`/
To remove the clause: s/CREATE DEFINER=[^ ]*/CREATE /
Bookmarks