Symptoms
-
Unable to import the MySQL dump via Subscriptions > example.com > Databases > Import Dump:
PLESK_ERROR: Unable to import the john_doe_database dump:
Unable to restore database ‘john_doe_database’
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1227 (42000) at line 1421: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
(Error code 22) -
The MySQL CREATE procedure together with the DEFINER directive is used in the dump several times for different users:
/*!50003 CREATE */ /*DEFINER=`John Doe`@% */ /*!50003 Some code */;;
/*!50003 CREATE */ /*DEFINER=`Sarah Kerrigan`@% */ /*!50003 Some code */;;
/*!50003 CREATE */ /*DEFINER=`James Raynor`@% */ /*!50003 Some code */;; -
Each user defined in the DEFINER directive in the MySQL dump have no SUPER privilege in the Tools & Settings > Database Servers > MySQL
> User accounts > John Doe > Edit privileges > Administration list.
Cause
This has been reported as bug ID PPPM-13086 which will be fixed in future updates.
Resolution
Solution 1
Provide all users in the dump with the required SUPER privilege. This means that the database user where the dump was exported from and the database user where the dump is imported to need SUPER privilege:
-
Go to Tools & Settings > Database Servers and click the
icon opposite the MySQL database server:
-
Navigate to the User accounts page and click the Edit privileges link opposite the required database user:
-
Mark the SUPER permission in the Administration list and press the GO button:
-
Import the MySQL dump via Subscriptions > example.com > Databases > Import Dump
-
Revoke the SUPER permission from the database user.
Repeat steps from 2 and 3, then uncheck the SUPER permission in the Administration list and press the GO button:
Solution 2
Modify the MySQL dump file by removing all DEFINER directives:
-
Create a backup of the current MySQL dump file.
-
Open the MySQL dump file in any text editor.
-
Find all DEFINER directives in the file and remove them:
[BEFORE]
/*!50003 CREATE */ /*DEFINER=`John Doe`@% */ /*!50003 Some code */;;
[AFTER]>
/*!50003 CREATE */ /*!50003 MySQL code */;;
Solution 3
On Linux, the following command can be used to remove all DEFINER from the dump file
-
Connect to the server via SSH
# plesk db dump john_doe_database | sed -e “s//*[^*]*DEFINER=[^*]**///” > db_without_definer.sql
OR
Remove DEFINER from the dump file directly:# sed -i.bak -e “s//*[^*]*DEFINER=[^*]**///” john_doe_database.sql
-
Proceed to import the dump file
On Windows sed for Windows can be used