How to copy/create a development database

Would someone please explain to me how to copy my database so I can use it as a development database to test workflows and such?

I am not very skilled with MySQL - thank you in advance.

Hi there,

Please use google or the MySQL forums. This is not a SuiteCRM related issue.



You don’t say what operating system you’re using, so I’ll answer your question for Linux, as that’s what I’m most familiar with. If you’re using Windows, the idea is basically the same, but you might need to double check the syntax.

You can create a dump of your database with mysqldump:

mysqldump -u <user with access to the database> -p <databasename> >> databasedump.sql

This will prompt you for the password of the user you entered, then dump the entire contents to a file called databasedump.sql (you can call this whatever you want).

Then you need to create an empty database for your test instance, and either create a new database user for that instance, or give your other database user access to that database.

Then, load your dumpfile into your test instance like this:

mysql -u <user with access to test database> -p <test database> < databasedump.sql

That will give you a test instance of your database. Then you need to create a test instance of your web application by copying the directory. In your new copy, find the config.php file, and look for the db_name setting, and change that to the name of your test database. You may also need to change the db_user_name and db_password settings, if you created a new user. You’ll also need to configure your web server to point to your new test instance too.