Upgrade OpenSim database from SQLite to MySQL

When you install OpenSim server for the OSGrid the default database is SQLite. That is a good choice because i makes you up and running with fewer possible errors. After running my regions for about a month and putting a few objects in place I could easily notice a degradation in performance and after reading a bit on the web and in forums the conclusion is obvious.

SQLite is only recommended for the setup face or for regions that are almost empty. So today I had a few hours to dig into how to do the upgrade from SQLite to MySQL and try it out for my self. To get this going as smoothly as possible i had to combine instructions from different sources as I could not find any good instructions for the current version and as the organization of ini-files recently changed most of the ones I found was even misleading…  ;o)

So this instruction is for the OpenSim version distributed for OSGrid at January 17 2011 namned 0.7.1 (Dev 9f7b37b).

Just as SQLite are MySQL Open Source so there is no cost for you. Just download, install and get going…. well not exactly. There are some pit holes.

Hopefully the step-by-step instruction below can help you a bit…

First some facts for my installation:

  • I run the operating system Ubuntu 10.10 on an old MacBook
  • I use SQLite and not MySQL (SQLite is the default installation)
  • I have 4 regions
  • My installation is in the bin directory in my home directory

1. First main step is to download and install MySQL.
I know many people are using windows… and i found a good a good instructions for how to download and install it on windows: http://opensimuser.wordpress.com/2010/03/04/updated-mysql-installation-guide/

On Ubuntu Linux it is even easier as MySQL is in the Ubuntu repository. Just open Ubuntu Software Center, search for MySQL and select Install. The lines below are for installing on Ubuntu.

2. You will be asked for a password for the database user. If you just answers that it will be the root that is the user.

3. Open a terminal window and start the MySQL command application

mysql -u root -p

4. Answer with the password you used selected

5. Then you get the mysql> prompt

6. Give the following command to create a database for OpenSim (don’t miss the ending semicolon)

create database opensim;

7. Done. Now quit the command application with the following command

quit; (don’t miss the ending semicolon)

Congratulations! Now we have our database!

If you have done anything at all to your region you need to backup the data from SQLite to a flat file that we later can import into MySQL.

Go to the OpenSim console terminal window:

8. Change to the region you want to save the data from. Mine is called Alinja. Give this command:

change region Alinja

9. Save the information about that region to a flat file with the same name. I select to place it in the directory above bin. GivE the command:

save oar ..\Alinja.oar

Do this for all your regions that you have valuable information in, like terrain, plants, buildings, scriots and so on.

10. Stop the OpenSim server by the command shutdown in the OpenSin window.

11. Now we need to tell the OpenSim server to use our new MySQL data base instead of the old SQLite database.
Go to the the directory bin/config-include/ and edit the file GridCommon.ini

Look at the screenshot below and change where the yellow markings are. Put semicolon in front of the lines to comment out SQLite and remove semicolon at the two lower lines to enable MySQL.

Please note that you have to change the username and password to what you have for your database. In Ubuntu the default user here is root and the password…. well you know that by now, don’t you?

12. Time to start up the server again. On Ubuntu it is:
sudo mono OpenSim.exe
Now we will get the same questions as when we started the sim.

13. Now we will load all the saved information back into MySQL. Change to the first region and upload the oar file with:

  • change region Alinja
  • load oar c:\Alinja.oar

Now do the same for the other regions.

14. Restart your OpenSim server….

Good job! Now we just have to fill all those Sims with something nice… and dont forget to send me a LM when you have done that.

Post a comment or leave a trackback: Trackback URL.


  • Anaxa  On August 7, 2011 at 6:31 pm

    there is no reason to run opensim as root, best to make a separate user (opensim orso) and run:

    (i made a bash script inside opensim/bin)

    # echo “Starting OpenSimulator If you get an error saying limit: Operation not permitted. Then you will need to chmod 0600 /etc/limits”
    ulimit -s 262144
    export MONO_THREADS_PER_CPU=125
    env LANG=C mono OpenSim.exe

  • Anonymous  On February 10, 2013 at 1:05 am

    Thanks, worked without problems for me.
    (Of course id did, in fact its just backup/restore region. Stupid me could have been coming to that by myself.)
    Sakura no Onnanoko

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: