Skip to Content

A Database Error Occurred Error Number: 1062

Database Error Occurred Error Number: 1062


Overview: This article provides a step-by-step guide to resolving the "duplicate entry" database error in Ezeelogin by truncating the prefix_qlogs table on both master and slave nodes, backing up the relevant databases, and synchronizing the tables through the Ezeelogin web user interface.


A Database Error Occurred

Error Number: 1062 Duplicate entry '[email protected]' for key 'user_name'

INSERT INTO `ccm_users` (`username`, `password`, `email`, `firstname`, `lastname`, `esc`, `eak`, `egs`, `usergroup_id`, `status`, `priv`, `crypt`, `created`) VALUES ('user2', '$6$rounds=5476$8pJj9AyVGb8tsq5X$FOsQvq2OszdAB99GZlaRhngaJXuKfs9Fzk9xV1aSnNOHemkyh44CxJbcb2TR/Yur2VIojfngBC15K7jTcWGnn/', '[email protected]', 'user2', '', '$6$rounds=5714$Ezm1DqIDVG6Gb2sA$jNoMl4wEsGsyp921H3frCAjuUUiE5J4hfS/UQDrY6fph/8otVODwH2HH5vBgaD1uu1ilu2cifjiDG54ZKk/Pi1', '', '', '2', 1, 0, '$6$rounds=5323$kZ8aNMQvXy10QaJU$XWlYZNhYV163HWedm2RMu7UjgWKccFEy7qJR.4atSOSsEhUHUSFoVBTnDok4W1abFCkzrgye/j3VwfVzwgVdz0', '2016-10-04 15:07:06')

Filename: models/Mcluster.php Line Number: 257

A Database Error Occurred

Error Number: 1062 Duplicate entry '[email protected]' for key 'user_email' INSERT INTO `ccm_users` (`username`, `password`, `email`, `firstname`, `lastname`, `esc`, `eak`, `egs`, `usergroup_id`, `status`, `priv`, `crypt`, `created`) VALUES ('user2', '$6$rounds=5476$8pJj9AyVGb8tsq5X$FOsQvq2OszdAB99GZlaRhngaJXuKfs9Fzk9xV1aSnNOHemkyh44CxJbcb2TR/Yur2VIojfngBC15K7jTcWGnn/', '[email protected]', 'user2', '', '$6$rounds=5714$Ezm1DqIDVG6Gb2sA$jNoMl4wEsGsyp921H3frCAjuUUiE5J4hfS/UQDrY6fph/8otVODwH2HH5vBgaD1uu1ilu2cifjiDG54ZKk/Pi1', '', '', '2', 1, 0, '$6$rounds=5323$kZ8aNMQvXy10QaJU$XWlYZNhYV163HWedm2RMu7UjgWKccFEy7qJR.4atSOSsEhUHUSFoVBTnDok4W1abFCkzrgye/j3VwfVzwgVdz0', '2016-10-04 15:07:06')

Filename: models/Mcluster.php

Line Number: 105

This error can be fixed by truncating the prefix_qlogs table. 

Step 1.  Login to the MySQL of Master node and take a  dump of Ezeelogin database, prefix_qlogs table and truncate prefix_qlogs table
     You can find the Ezeelogin database name from /usr/local/etc/ezlogin/ez.conf file.

root@jumpserver:~ mysqldump -u root -p ezeelogin_database_name > ezeelogindatabasebackup.sql

Note: 
You can find the Ezeelogin database name and table prefix from /usr/local/etc/ezlogin/ez.conf file. Replace prefix with your database prefix.

root@jumpserver:~ mysqldump -u root -p ezlogindb_prefix prefix_qlogs> prefix_qlogs.sql

You should truncate the prefix_qlogs table with the following command.

mysql> truncate table prefix_qlogs;

Step 2.  Login to the MySQL of Slave node and take a dump of Ezeelogin database, prefix_qlogs table and truncate prefix_qlogs table

root@jumpserver:~ mysqldump -u root -p ezeelogin_database_name > ezeelogindatabasebackup.sql

root@jumpserver:~ mysqldump -u root -p ezlogindb_prefix prefix_qlogs > prefix_qlogs.sql

You should truncate the prefix_qlogs table with the following command.

mysql> truncate table prefix_qlogs;

Step 3. Login to Ezeelogin WUI of Master node and click on cluster tab > Verify database > sync the tables.

3e3ba1660e2ee7107768573b9147520e9630bbdcacd9c3ab92f03f4f9dc7602c8d5537949d0b5071?t=2bf642e996d8f99313a8782c5ff5eeb4

Step 4.  Login to Ezeelogin WUI of Slave node and click on cluster tab > Verify database > sync the tables.
1f3780477635002f53cb6c2adf07d203c6747793c56686099870d466c52bda273988e2a8a94e9c0d?t=ae1e14dad444e9d08a97c7785df8f160


Related Articles
Error: This node in cluster has local changes. Please verify database and synchronize: DB sync incomplete

Switching node states in Ezeelogin Cluster