Creating a WSO2 Carbon Database Dump and Restoring - MySQL 5.1
- Yumani Ranaweera
- Director Customer Success - WSO2
In this guide I will be showing you how to create a WSO2 Carbon data dump in MySQL 5.1 and how to restore it.
- Create and configure Carbon database.
- Create a database
- Create user and grant access to the above database.
- Run the mysql.sql script to configure the database. The script resides in CARBON_HOME/dbscripts/ folder.
- Next copy the database driver to CARBON_HOME\repository\components\lib and point the configuration files (usermgmt.xml, registry.xml) to the database and start the Carbon server.
- Fill in the database with data.
- Create a backup.
- Create a backup of the database by issuing the following command in command prompt. In the above example, 'regdb' database will be backed-up in 'regdb_back.sql' file. The dump will be created in the place where you are executing the command from.
- Restore the database
- To restore the database from the above dump you must first clean the previous environment. Login to mysql and drop previous user and the database and recreate them. Remember to grant same permission to the user.
- After the schema is cleaned, import the backup using the following command. In the example that I've given below, 'regdb' database will be restored using 'regdb_back.sql'
I will be using mysql command line tool throughout the process, therefore lets login to mysql prompt like below.
~$ mysql -u <username> -p<password>
mysql> create database <db_name>
mysql>GRANT ALL ON <db_name>.* TO <user_name>@<host> IDENTIFIED BY "<password>";
mysql>use <db_name> mysql>source mysql.sql;
You may use Carbon Server web console for this. Further information can be found in product documentation available in here.
$ mysqldump -u <username> -p<password> <database_name> > backup_location/backup.sql e.g. $ mysqldump -u root -proot regdb > /home/yumani/Documents/regdb_back.sql
$ mysql -u <username> -p<password> <database_name>
Author
Yumani Ranaweera
Associate Technical Lead - Quality Assurance; WSO2, Inc.
[email protected]