Parallels H-Sphere Documentation System Administrator Guide

 

Moving MySQL Accounts

 
 

Related Docs:   MySQL Server Installation And Configuration Moving Mail Service Moving Mail Domains

Last modified: 27 Dec 2007

 

WARNING: This documentation covers Parallels H-Sphere versions up to 3.1. For the latest up-to-date Parallels H-Sphere documentation, please proceed to the official Parallels site.

WARNING:
The undermentioned procedure is recommended for experienced H-Sphere owners only!

All MySQL resources of the particular H-Sphere account are called MySQL account hereinafter. The following steps explain how to move all databases of a particular H-Sphere account to a new logical MySQL server and apply changes to the H-Sphere database.

To move MySQL account:

  1. Log into the source MySQL server and get MySQL root password that will be generated after entering the following command:
    # cat ~mysql/.my.cnf
  2. Export user account databases on source MySQL server with the help of mysqldump utility:
    # mysqldump -Q -uroot -p DBNAME > DBNAME.sql
    where DBNAME is the database name.
    This should be applied to every user database within the account.
  3. Dump user database privileges on source MySQL server:
    # mysqldump -c -e -Q -t mysql -uroot -p db -w "db like 'USERNAME_%'" > USERNAME_mysql.db.sql
    where USERNAME is an H-Sphere user prefix for database.
  4. Log into CP server. Change MySQL logical server id for the account:
    # su - cpanel
    # java -Xms64M -Xmx256M psoft.hsphere.tools.ChangeLServerId -a ACC_ID --from OLD_LID --to NEW_LID
    where:
    ACC_ID - the account id
    OLD_LID - source logical mysql server ID
    NEW_LID - target mysql logical server ID
  5. Create empty databases on the target MySQL server:
    # su - cpanel
    # java -Xms64M -Xmx256M psoft.hsphere.tools.PhysicalCreator -rg mysql -co -lid NEW_LID -accs ACC_ID
  6. Transfer all DBNAME.sql and USERNAME_mysql.db.sql files from the source server to the target MySQL server
  7. Log into the target MySQL server and get MySQL root password that will be generated after entering the following command:
    # cat ~mysql/.my.cnf
  8. Import databases:
    # mysql -uroot -p DBNAME < DBNAME.sql
  9. Restore user database privileges:
    # mysql -uroot -p mysql < USERNAME_mysql.db.sql
    # mysqladmin reload -p
  10. Restart H-Sphere CP
  11. Make sure to check MySQL dbs functionality on the target server. If it is ok, you may delete MySQl databases from the source server by running the following commands:
    /hsphere/shared/scripts/mysql-drop-database DBNAME
    /hsphere/shared/scripts/mysql-delete-user USERNAME

Perform steps 2,3,8,9,11 for each MySQL db and user of the current H-Sphere account on the source MySQL server.


Related Docs:   MySQL Server Installation And Configuration Moving Mail Service Moving Mail Domains



© Copyright 2017. Parallels Holdings. All rights reserved.