When importing a database as a cPanel (non-root) user, you receive messages similar to the following.
CREATE ALGORITHM=UNDEFINED DEFINER=`user`@`localhost` ...
#1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation
This error occurs when the database dump contains queries that cannot run as the current user, such as a query that creates a database under a different name or a query that defines a definer that is entirely a different user that might not even exist on the server.
The following solutions should be performed by a qualified system or database administrator, as incorrect modifications can corrupt the database or prevent MySQL/MariaDB from restarting.
- Replace the related query with one that can be run as the current user, such as replacing the definer with the current username.
- Edit the .sql dump file and remove the offending query line.
- Import the database as the root user.
Please note that this is HIGHLY discouraged, as the database dump may be compromised and could give unauthorized access to your entire system.