Skip to content
diva edited this page Feb 15, 2011 · 6 revisions

Instructions for installing and configuring MySQL for diva distribution of OpenSim
© Crista Lopes. All rights reserved.

1 – Install MySQL and, optionally, MySQLAdmin. See
http://dev.mysql.com/downloads/
If you are in Linux, MySQL is probably already installed:
$ mysql —version

Installing and configuring MySQL can be extremelly easy or extremelly
difficult depending on your operating system and your prior knowledge
in system administration. Installing MySQL in modern Windows versions
is straightforward, and you shouldn’t encounter any major
issues. Similarly, most modern Linux systems already have MySQL
installed; you just need to Google for how to configure it and run the
server as demon in your particular version of linux. The difficulties
increase for older operating systems which may not run the right
version of MySQL (5 or greater is recommended). If you encounter
difficulties running MySQL, make sure to use plenty of Google, or ask
a sys admin for help.

After installation, start MySql server, and start the command line
console for the mysql root account.

$ mysql -u root -p -h localhost

If this doesn’t work, try su or sudo as root
$ sudo mysql

Next,
- create a schema called opensim:
mysql> create database opensim;

- create a user account called opensim with any passwd you want.
Please choose a good password!
mysql> create user opensim identified by ‘your_password_here’;
(You may also want to
mysql> create user ’opensim’@’localhost’ identified by
‘your_password_here’;
)

- give all privileges to that user for access to the opensim schema:
mysql> grant all on opensim.* to opensim;
mysql> grant all on opensim.* to ’opensim’@’localhost’;

- make MySql server reload the user data:
mysql> FLUSH PRIVILEGES;

NOTE: The 2 middle commands are only available for MySQl 5. If your installation is older, or if they don’t work, do this instead:
mysql> use mysql;
mysql> insert into user (Host, User, Password, Select_priv,
Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,
Reload_priv,Process_priv,File_priv,References_priv,Index_priv,
Alter_priv) VALUES (‘localhost’,‘opensim’,
PASSWORD,
‘Y’,‘Y’,‘Y’,‘Y’,‘Y’,‘Y’,‘Y’,‘Y’,‘Y’,‘Y’,‘Y’,‘Y’);
mysql> FLUSH PRIVILEGES;


TROUBLESHOOTING

When you run OpenSim later on, you may encounter MySQL-related errors like this:

23:10:13 – ============== 23:10:13 - STARTING OPENSIM 23:10:13 - ==============
23:10:13 – [OPENSIM MAIN]: Running in sandbox mode
23:10:13 – [DATASTORE]: Attempting to load OpenSim.Data.MySQL.dll
23:10:13 – [REGION DB]: MySql – connecting: Data Source=localhost;Database=opensim;User ID=opensim;Password=*;
23:10:13 – [APPLICATION]:
APPLICATION EXCEPTION DETECTED: System.UnhandledExceptionEventArgs

Exception: MySql.Data.MySqlClient.MySqlException: Access denied for user ’opensim’@’localhost’ (using password: YES)
at MySql.Data.MySqlClient.MySqlStream.OpenPacket () [0×00000]
at MySql.Data.MySqlClient.NativeDriver.Authenticate411 () [0×00000]
at MySql.Data.MySqlClient.NativeDriver.Authenticate () [0×00000]
at MySql.Data.MySqlClient.NativeDriver.Open () [0×00000]
at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0×00000]
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection () [0×00000]
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection () [0×00000]
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver () [0×00000]

Errors like this mean that there is something wrong with your MySQL setup. In this particular error, the opensim account @ localhost has not been given access to the MySQL server. This is easy to test:

$ mysql -u opensim -p -h localhost

If you can’t login to the server like this, then OpenSim can’t do it either. Go back to logging in as root and make sure that the opensim account @ localhost is active:

mysql> use mysql;
mysql> select Host, User from user;

Create additional opensim accounts @ different variations of the hostname.


ADVANCED
(This section is underspecified on purpose. This should only make sense for people who know MySQL. If you don’t know where these variables are, then you probably shouldn’t mess with them)

If your virtual world often has many users logged in at the same time, and if you are familiar with MySQL, here are some recommended settings for it:

interactive_timeout=1000
wait_timeout=1000
connect_timeout=1000
key_buffer_size = 256M
max_allowed_packet = 128M
max_connections = 4000
long_query_time = 3

Clone this wiki locally