MySQL

Aus Limbas Wiki

Wechseln zu: Navigation, Suche
Diese Seite ist eine übersetzte Version der Seite MySQL und die Übersetzung ist zu 100 % abgeschlossen sowie aktuell.

MySQL Installation

The required software packages for MySQL can be installed under RedHat/Fedora/CentOS with the following command:

yum install mysql mysql-server mysql-connector-odbc

Now the MySQL server can be started:

/etc/init.d/mysqld start

For production environments, a secure installation should be setup using the following tool:

/usr/bin/mysql_secure_installation

First, the root password has to be set (empty by default):

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

After this the anonymous user has to be deactivated:

Remove anonymous users? [Y/n] y
 ... Success!

All of the following settings can be set individually:

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Configuration

For correct setup, the global configuration has to be changed by adding the following lines to the file /etc/my.cnf under the entry "mysqld":

[mysqld]
...
default-storage-engine=InnoDB
lower_case_table_names = 1

Database Engines (InnoDB or MYISAM)

MySQL gives the choice between the two database engines InnoDB and MYISAM. For transaction based applications InnoDB has to be used. In contrast to MYISAM only this engine supports transactions as well as foreign keys. Thus InnoDB is the recommended by default. If LIMBAS is mainly used for read access and data integrity is no issue, then MYISAM is an alternative option. Note that further engines have not yet been tested with LIMBAS.

Create Database

Now the MySQL console can be called with the previously defined password:

mysql -u root -p

A database for Limbas is now created in the MySQL console as follows:

mysql> CREATE DATABASE <limbasDB>;
Query OK, 1 row affected (0.00 sec)

Furthermore for accessing the Limbas database, a separate user should be setup:

mysql> GRANT ALL ON <limbasDB>.*
    ->   TO <limbasuser>@localhost IDENTIFIED BY '<limbaspassword>';
Query OK, 0 rows affected (0.00 sec)

ODBC Configuration

There are two variants of connecting LIMBAS to the database:

  • Connection with direct ODBC driver access
  • Connection with ODBC-resource

The following two points are to be carried out for both variants:

  • Determine the paths of the configuration files of unixODBC:
$ odbcinst -j
unixODBC 2.2.14
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
USER DATA SOURCES..: /<user>/.odbc.ini
  • Add a driver definition to the configuration file "DRIVERS" (in this case "/etc/odbcinst.ini"). If the following lines are similar, you can skip this step. :
[MySQL]
Description     = ODBC for MySQL
Driver          = /usr/lib/libmyodbc5.so
Setup           = /usr/lib/libodbcmyS.so
Driver64        = /usr/lib64/libmyodbc5.so
Setup64         = /usr/lib64/libodbcmyS.so


The following point is only necessary for a connection using ODBC-resource

  • Add the following entry to the configuration file "SYSTEM DATA SOURCES" (in this case "/etc/odbc.ini"):
[limbas_resource]
Description             = MySQL
Driver                  = MySQL
Database                = <limbasDB>
Username                = <limbasuser>
Password                = <limbaspassword>
Port                    = 3306
Trace                   = Off
Server                  = localhost
Charset                 = latin1

Limbas Installation Hints

When installing LIMBAS using the ODBC driver, note that with MySQL, the database scheme is the same as the database name. InstallerResource.png