MySQL Database

Installation

To check whether MySQL is installed on your system execute the following as root:

root@ubuntu-amg:# dpkg -l "mysql-server"

If MySQL is installed on your system, the line similar to this should be printed:

ii  mysql-server                                   5.5.22-0ubuntu1   
MySQL database server (metapackage depending on the latest version)

If MySQL is not installed (i.e. the output is radically different than the one above) execute the following to install MySQL:

root@ubuntu-amg:# apt-get install mysql-server

Configuration
This section explains how to configure MySQL server character set to speak UTF-8

1. Edit my.cnf file

root@ubuntu-amg:# vim /etc/mysql/my.cnf

2. Add to [mysqld] section following lines (MySQL server only):

[mysqld]
character_set_server=utf8
collation_server=utf8_bin
init_connect='set @@collation_connection = utf8_bin;'

3. Configure [client] section (all machines):

[client]
default-character-set=utf8

4. Restart MySQL server daemon if it is already started

root@ubuntu-amg:# /etc/init.d/mysql restart

Initial Data

This section explains how to configure MySQL server for xms. Any other schema and/or user might be created similarly

1.Connect to MySQL Admin Console:

root@ubuntu-amg:# mysql -u root -p

2. Create a database instance that will be used by the xms:

mysql> create database xms default character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.01 sec)

3. Create a database user that will be used by the HPCoD portal to connect to the database:

mysql> create user 'xms' identified by 'xms';
Query OK, 0 rows affected (0.04 sec)

4. Grant proper privileges for the newly created user:

mysql> grant all on xms.* to 'xms'@'%' identified by 'xms';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on xms.* to 'xms'@'localhost' identified by 'xms';
Query OK, 0 rows affected (0.00 sec)

 Note
Run this command only if you plan on connecting to the database from remote machines:

mysql> grant all on xms.* to 'xms'@'%' identified by 'xms';

Finally, execute

flush privileges;

5. Verify the setup:

root@ubuntu-amg:# mysql -u xms -p
mysql>use xms;
Database changed
mysql> create table test(id int(5) not null primary key);
Query OK, 0 rows affected (0.01 sec)
mysql>drop table test;
Query OK, 0 rows affected (0.01 sec)
mysql>exit;

 If the database existed before performing steps from this instruction make sure that it has proper encoding by executing:

ALTER DATABASE xms DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;


This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 5.4.6 - Documentation - Legal Notice

Site maintained by