Saturday, 18 October 2008
13:28 | Posted by Rock
Moving a MySQL Database
While I am waiting for my server (which hopefully be available on either Monday or Tuesday), which has a Windows 2008 Web Server OS, I thought I would have a go at moving my opensim and MySQL database from my home PC to my laptop, to see if it was straightforward. I am glad I have tried to have a go, because I got bogged down for quite a while, but fortunately with the help of DigiDaz from the #opensim irc channel, I eventually got there. Here are the steps:
1. Getting opensim onto my laptop was as easy as copying my bin folder from my home PC onto a memory stick, and copying it onto my laptop.
2. I then installed MySQL onto my laptop. When configuring I used the same user name (root) and password as on my PC, I then created an empty opensim database. (see article 5 on the 6th September, below, for full instructions on installing MySQL and creating the opensim database).
3. On my PC I made a backup copy of my opensim database. I did this by opening a command console window (go to Start, Run, and type 'cmd' (without the quotes) in the Open: box.). In the command console I typed the following:
mysqldump -u root -p opensim > opensim.sql
This command starts the mysqldump backup utility. The full syntax for this command is:
mysqldump -u [username] -p [databasename] > [backupfile.sql]
username = the user name you use in MySQL, usually 'root'
the -p switch will prompt you for the password you use for MySQL
databasename = the name of the database you wish to backup, in our case this is 'opensim'
backupfile.sql = the name of the backup file, can be anything, I chose 'opensim.sql'
I had to do a search to see where this file had been saved, I found it in the 'C:\Documents and Settings\Colin' folder.
4. I then copied opensim.sql file onto my memory stick, and pasted it in the C:\ root folder on my laptop.
5. I then opened a command console on the laptop, and navigated to the root folder by typing:
(it is important to be in the same folder as the test.sql file)
6. I then restored the database by typing at the command console:
mysql -uroot -p opensim < opensim.sql
It was successful and it returned me to the c:\ prompt.
7. After starting my Opensim, and logging in with my Hippo viewer, I was pleased to see my region exactly as it was on my PC.
A very happy bunny indeed, eventually :)
Again, many thanks to DigiDaz.