Last Updated: February 25, 2016
·
713
· wajatimur

Opencart Database Trigger for Admin Password Override

If we want to persist the admin password for the OpenCart demo site, we can use trigger in MySQL. Before you execute the following SQL script, we have to make sure that our database engine for oc_user table is InnoDB.

CREATE DEFINER=`root`@`localhost` TRIGGER `oc_user_before_update` BEFORE UPDATE ON `oc_user` FOR EACH ROW BEGIN
    SET NEW.password = '6b85738a44ed1398902224d94fc69844e24f36d8';
    SET NEW.salt = '6473b1391';
END

The NEW.password and NEW.salt keyword is the column name that you want to modified. You can use others column instead if require.