auto_increment flag in MySQL tables lost after Plesk migration
Overview
We have discovered a bug in the Plesk Migration Tool when migrating from a (dv) 3.0 to a (dv) 3.5 server. Imported MySQL databases will lose the auto_increment flag on all of the database tables.
The following workaround will automatically re-dump all the data from your source (dv) 3.0 server and import it correctly to your newer (dv) 3.5 server.
Requirements
This article has the following dependencies:
- If you currently do not have your root user enabled, please visit the Root Access & Developer Tools section of your AccountCenter. For instructions, please see: Install the Developer Tools.
- (mt) Media Temple does not support the installation and configuration of software not installed at time of service activation. Please consult our (dv) Scope of Support page for further explanation.
- The following article is provided as a courtesy to our customers and may not work in all cases. Please keep a backup of all your data before performing the following steps.
CAUTION:
Only run this after a complete migration. It will have errors if the databases do not exist already on your (dv) 3.5 server.
Instructions
- Please create a new file on your (dv) 3.0 server, i.e. the source. Give the file a descriptive name, such as dumper.sh. The final step in this script will attempt to transfer this dump file to your (dv) 3.5 server, or the destination server. Please make sure you have your root password available for this step.
#!/bin/bash
mysql -u admin -p`cat /etc/psa/.psa.shadow` -e "show databases" > dbs.temp
cat dbs.temp |grep -v Database|grep -v phpmyadmin|grep -v mysql |grep -v horde |grep -v psa > dbs
for i in `cat dbs`; do echo "** DOING DB $i ***"; mysqldump --add-drop-table -u admin -p`cat /etc/psa/.psa.shadow ` $i > $i.sql ; done
mkdir sql; mv *.sql sql
scp -r sql root@ xxx.xxx.xxx.xxx:/root/
- Log in as root on your (dv) 3.5 server and create the following script. Name it importer.sh. Running this script should repair your databases.
#!/bin/bash
cd ~/sql
for i in `ls -1`; do echo "*** $i ***"; mysql -u admin -p`cat /etc/psa/.psa.shadow` -D `echo $i|sed 's/.sql//g'` < $i ; done
All of your database tables should now have the auto_increment flag enabled again. We do apologize for this bug and have notified Parallels, the makers of Plesk. We will update this article should it become no longer apply to our (dv) 3.5 Dedicated-Virtual Servers.