How to migrate LDAP to other computer

How can I migrate LDAP from one computer to other..??

I tried using:

slapcat -n 0 -l (config file location)

and

slapcat -n 1 -l (database backup ldif path)

It gives this error:

$ slapcat -d -1 -l slapd.d/cn\=config.ldif 
5acd24a4 slapcat init: initiated tool.
5acd24a4 slap_sasl_init: initialized!
5acd24a4 backend_startup_one: starting "cn=config"
5acd24a4 ldif_read_file: read entry file without checksum: "/etc/ldap/slapd.d/cn=config.ldif"
5acd24a4 => str2entry: ""
5acd24a4 str2entry: entry -1 has no dn
5acd24a4 send_ldap_result: conn=-1 op=0 p=0
5acd24a4 send_ldap_result: err=80 matched="" text="internal error (cannot parse some entry file)"
slapcat: bad configuration file!

Solution 1:

-l is for output, not the location of the config.

You probably wanted something more akin to slapcat -n 0 -F /etc/openldap/slapd.d/ -l ~/slapdconfig.ldif.

At this point you may have destroyed your config (or at least the cn=config part of it. Hopefully you have a backup. If not, you may be able to extract it from the running server if you have a dn with appropriate access to cn=config. Be sure to get both the * and + attribute sets.