Magento – Magento 2: I’m unable to save new products

databasemagento-2.1magento2-migration-toolmigrationproduct

My website is running on Magento 2.
I have migrated data from Magento 1.x to version 2.1 using UB data migration tool.
Now I am planning to upgrade Magento 2.1.3. After Magento upgrade

I am unable to save new products. It shows error:

SQLSTATE[HY000]: General error: 1449 The user specified as a definer
('rb_magento2'@'localhost') does not exist, query was: INSERT INTO
catalog_product_entity (entity_id, attribute_set_id, type_id,
sku, has_options, required_options) VALUES (?, ?, ?, ?, ?, ?)

The user rb_magento2 is or live Magento database but I have created a copy of Magento on a new server with the different username.

Best Answer

I had the same problem and I got the solution doing this:

  1. Export database using the following command:

    mysqldump -h [database_host] --user=[database_username] --password=[password] --single-transaction main | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | gzip > /path/to/database_name.sql.gz
    
  2. Import the database again.

The error is caused because the user rb_magento2 doesn't exist or doesn't have permissions.

Also you can try creating a user with name rb_magento2 but the first solution is the most recommended.

Check this doc: https://devdocs.magento.com/guides/v2.2/cloud/live/stage-prod-migrate.html#troubleshooting-the-database-migration

Related Topic