So you’re trying to import a Magento 2 database let’s say maybe through Phpmyadmin and you’re getting an error that sound like this: MySQL: #1227 – “Access denied; you need (at least one of) the SUPER privilege(s) for this operation” ?
Easy fix.
The problem lies in the fact that the user mentioned in that CREATE statement does not have enough permissions to create it.
So before you try to import, edit that SQL database dump as stated below.
Somewhere in the database export file you have something like this:
CREATE ALGORITHM=UNDEFINED DEFINER='root@whatever' SQL SECURITY INVOKER VIEW `inventory_stock_1` AS select distinct `legacy_stock_status`.`product_id` AS `product_id`,`legacy_stock_status`.`website_id` AS `website_id`,`legacy_stock_status`.`stock_id` AS `stock_id`,`legacy_stock_status`.`qty` AS `quantity`,`legacy_stock_status`.`stock_status` AS `is_salable`,`product`.`sku` AS `sku` from (`cataloginventory_stock_status` `legacy_stock_status` join `catalog_product_entity` `product` on((`legacy_stock_status`.`product_id` = `product`.`entity_id`)));
You need to change it to this:
CREATE ALGORITHM=UNDEFINED DEFINER=CURRENT_USER SQL SECURITY INVOKER VIEW `inventory_stock_1` AS select distinct `legacy_stock_status`.`product_id` AS `product_id`,`legacy_stock_status`.`website_id` AS `website_id`,`legacy_stock_status`.`stock_id` AS `stock_id`,`legacy_stock_status`.`qty` AS `quantity`,`legacy_stock_status`.`stock_status` AS `is_salable`,`product`.`sku` AS `sku` from (`cataloginventory_stock_status` `legacy_stock_status` join `catalog_product_entity` `product` on((`legacy_stock_status`.`product_id` = `product`.`entity_id`)));
Basically you need to change DEFINER to equal CURRENT_USER. That’s it!
Have fun!