Steps to create users using mysql details where accounts accidently removed from the LDAP

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Create users using MySQL details where accounts accidently removed from the LDAP

   KB 23362        Last updated on 2020-09-17  

(0 votes)


1st Scenario: LDAP got corrupt and we do not have latest LDAP backup.

2nd Scenario: Somehow users removed from LDAP and we still have account entries in MySQL DB.


In this situation, we have to restore LDAP with available backup and then we will extract accounts' entry from MySQL DB.

From MySQL, we have to extract mailbox id, account id, and email-addresses of missing accounts.

After collecting all missing or removed account's details we will create the account with the Zimbra id.

This is the complete description of activity which we have to perform

1). Missing accounts' list extract from MySQL database:-

  • Using the following command we can extract accounts' list from a particular domain.
mysql -e 'select id, account_id, comment from zimbra.mailbox where comment regexp "";' 
| id  | account_id                           | comment                          |
| 771 | ee4b049a-3d99-4908-b2b8-5cb069350ec8 |              |
| 773 | c01cfd8d-69d9-44c8-8234-99371fd19205 |       |
| 774 | 1e4645e8-2e37-48be-ac71-34bd144850f6 |        |
| 775 | d2a8b102-76df-4b99-a06a-ca64be3eae5d |        |
  • If we have only one domain then we can run MySQL query without where clause.
mysql -e 'select id, account_id, comment from zimbra.mailbox;'

2). Now we have to re-create accounts on LDAP with the same zimbraId:-

zmprov ca test1234 zimbraId 'ee4b049a-3d99-4908-b2b8-5cb069350ec8'
zmprov ca test1234 zimbraId 'c01cfd8d-69d9-44c8-8234-99371fd19205'
zmprov ca test1234 zimbraId '1e4645e8-2e37-48be-ac71-34bd144850f6'
zmprov ca test1234 zimbraId 'd2a8b102-76df-4b99-a06a-ca64be3eae5d' 

3). After the above steps we have to check and verify the mailbox id, quota details, folder and mail counts of created accounts:-

zmprov gmi
mailboxId: 771
quotaUsed: 5668 
zmmailbox -z -m gaf

Submitted by: Heera Singh Koranga
Verified Against: ZCS 8.8, 8.7, 8.6, 8.5 Date Created: 2018-08-13
Article ID: Date Modified: 2020-09-17

Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search