Replicate Database for Site Duplication

I tried with taking backup of current database & importing it for the duplicate site, and also made changes in app/config/local.php file accordingly, but didn’t work. It says “Database Connection: Error”, Can anyone help in this ?

That is how I do mine, just make sure you are 100% certain of the connection creds, your MySQL is setup to allow it and that PHP has the required modules to do so.

you need to migrate database , as per mautic version accordingly, have you done that?

Thank You kgroves for the reply, but it didn’t work for me, again it says “Database Connection: Error”

Thank You Bizcrony for the reply, I need to duplicate the database for site duplication.
Database Migration as per mautic version is worked for me, but replication of the same is not.

Are Mautic and the new database running on the same host machine?

Yes

@yogesh why dont you install a fresh mautic and use old local.php file …that way you will automatically get old database as you running your mautic presently.

YOGESH, are you able to access the server (and database) via MySQL CLI or phpMyAdmin?

@bizcrony I don’t want to use old database, I want to copy old database for duplicate site
Note: Site duplication means Live site & Staging site, both the sites will have their own respective databases. For now, I have one Live Site & I want to make another site exactly same as my Live site with all data. So, in this way I want to replicate my site.
However till now, I tried copy database for duplicate site along with changes in Local.php, but it didn’t work.

@petertl Yes I have access to server (and database) via MySQL CLI or phpMyAdmin or adminer.

Note: Site duplication means Live site & Staging site, both the sites will have their own respective databases. For now, I have one Live Site & I want to make another site exactly same as my Live site with all data. So, in this way I want to replicate my site.
However till now, I tried copy database for duplicate site along with changes in Local.php, but it didn’t work.

You need to export mysql from phymyadmin

YOGESH, I do almost exactly the same what you do. I think the only difference is that - in my case - both production and development/Staging are located on the same server. Here is what I do (host configuration is setup previosly):

  1. Dump the production DB with MySQL CLI
  2. Copy all Mautic files to another folder in WWW root
  3. Create an empty DB
  4. Restore the DB dump into the new DB
  5. Modify app/config/local.php:
    • DB name (the new one)
    • Site URL
    • Directories (cache, log)
  6. Just to be sure: CHOWN and CHMOD everything as it has to be
  7. Clear application cache

If both Mautic app and DB are on the same host, you don’t need to modify the DB host (use “localhost”).

Topic phpMyAdmin: You can dump your DB with phpMyAdmin, but you better not use it to restore. As your application data grow, you will shortly run into performance/timeout issues.

how to open phpmyadmin. I am new to mautic