Sync databases across versions
Posted by: sankesolutions (91.84.241.---)
Date: August 22, 2010 01:42PM

Hi I was wondering if there is some script or tool, that allows you to sync all your databases across the mysql versions you have installed. I considered using a sync tool, but this would require both mysql databases online at all time to carry out the sync which is not possible.

Im wondering if there is something that runs when you switch versions which hard copies the DB files from one version of Mysql to another so you can seamlessly test the same data across versions quickly.

thanks
Paul M

Options: ReplyQuote
Re: Sync databases across versions
Posted by: Otomatic (---.fbx.proxad.net)
Date: August 22, 2010 07:58PM

Hello,

I often answer the questions in the French forum and it gives me a lot of work. This is why I rarely answer questions from the English forum and also by what my English is not very good.

But to your question, I think the best way is to not put the data - in this case the databases - in the same tree as WampServer. Thus, changes in the version of MySQL, you have almost nothing to do and you do not lose your base or the MySQL users and passwords.

Note: Procedure explained with WampServer installed on G:\wamp
Adjust the paths depending on your installation
B - Move databases elsewhere than in wamp/bin/mysql/mysql5.1.x/data
B0 - Exit WampServer
B1 - Create a folder where you want your databases, for example: G:\wwwbases
B2 - Move * ALL * files and folders from G:\wamp\bin\mysql\mysql5.1.xy \data\ to G: \wwwbases\
B3 - Edit the file G:\wamp\bin\mysql\mysql5.1.xy\my.ini
Replace datadir = "G:/wamp/bin/mysql/mysql5.1.xy/data/"
By datadir = "G:/wwwbases/"
B4 - Launch WampServer

The next change of version of MySQL, the only thing to do is change the line datadir= of the new file G:\wamp\bin\mysql\mysql5.1.xy\my.ini to recover your databases, your users and your passwords.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Sync databases across versions
Posted by: sankesolutions (91.84.241.---)
Date: August 22, 2010 09:45PM

Thank you very much, that works brilliantly smiling smiley

I put my folder in
datadir =c:\wamp\mysqldatabases

and it works fine I also added a readme for future use.

Thanks again, this is working across all my versions of mysql installed now. Only thing I need to do is log out and log back into phpmyadmin.

grinning smiley

Options: ReplyQuote
Re: Sync databases across versions
Posted by: Otomatic (---.fbx.proxad.net)
Date: August 23, 2010 12:12PM

Hello,

Another thing to check when you moved the databases then changing versions of MySQL is to verify that the databases are compatible with the new version.

- 1 - In the folder containing your database, by default "wamp\bin\mysql\mysql5.1.3x\data" do you have a file "mysql_upgrade_info"?
Note: The folder containing your database is the content of "datadir =...." of file "wamp\bin\mysql\mysql5.1.xy\my.ini"
- 2 - Does it contain "5.1.xy? (The number of MySQL version used)

If you answer NO to 1 or 2, you have great chances of error occur: "Table 'mysql.servers' does not exist" and possibly other errors because there was no verification concordances of your databases with the new version of MySQL.

Note: The table mysql.servers is used by the database engine type FEDERATED but with some SQL statements, it is verified and the error if it does not. This table is not installed during upgrades because the software can not do all that is required because it is not "client" and it can not access the database but only for files system.

Therefore, it is provided that allows the program mysql_upgrade.exe modify tables that require changes after an update or a change in MySQL.

This progamme MUST be executed after each update or change the version of MySQL.

For Windows users, non-aficionado of the command line, here's how to do.
Save the existing databases (better safe than sorry!). The file containing your databases correspont content of "datadir =...." File "wamp \ bin \ mysql \ mysql5.1.3x \ my.ini" except the mysql tables containing specific to MySQL.

First, we must start the database server, then start WampServer
Then start a command window by start, run and type
% Systemroot%\system32\cmd.exe

Move to the bin folder of the new version of mysql:
wamp\bin\mysql\mysql5.1.xy\ bin

Arriving there the question is whether or not you put a password for root@localhost

If password, type:
mysql_upgrade.exe --user=root --host=localhost --password=your_password

If noit password, type
mysql_upgrade.exe --user=root --host=localhost --password=

then wait for the end of procedure.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.