After shifting the website to another server. Products are showing out of stock

I found the error while uploading the database file.

 CREATE ALGORITHM=UNDEFINED DEFINER=`user`@`localhost` 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`)))

1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation for


1 Answer 1


Assuming you have access to the SQL data dump file, you need to remove all definer tags from the SQL data dump file before moving.

Remove all DEFINER= entries from SQL import file.

DEFINER privileges are different from the GRANTS, the user is not allowed to execute DEFINER statements.

(assuming user/host service is allowed to run definer privileges)
CREATE DEFINER = **control_panel_username**@localhost FUNCTION ...................

  • (If you are using another method of importing "shifting", then you need to give us more details). May 27, 2020 at 12:11
  • only one "DEFINER="is mentioned as I see on the database file. I've already removed that before uploading the SQL file. Website is running bur all products are showing OUT OF STOCK. I got the above error while uploading SQL file.
    – Mahendra
    May 27, 2020 at 12:15
  • Since you already also confirmed GRANTS, have you tried indexing Magento 2? bin/magento indexer:reindex May 27, 2020 at 12:20
  • Yes, I did the indexing and cache flush
    – Mahendra
    May 27, 2020 at 12:23
  • I have no other idea, other than verifying that stock quantities are actually imported in the database. Not sure about all the tables, but cataloginventory_stock_status has fields like is_saleable and quantity. Also verify if inventory_stock_1 exists and has data. May 27, 2020 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.