> For the complete documentation index, see [llms.txt](https://xoops.gitbook.io/xoonips-tutorial/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xoops.gitbook.io/xoonips-tutorial/3installation/4.-customize-centos5/48setup_for_mysql.md).

# 4.8. Setup for MySQL

Set up for a database system to be used on XooNIps:

| **\[root\@xoonips-server \~]# vi /etc/my.cnf**           | ← Config file editing. |
| -------------------------------------------------------- | ---------------------- |
| Add the following two lines in the section of \[mysqld]. |                        |
| **default-character-set=ujis**                           |                        |
| **skip-character-set-client-handshake**                  |                        |

## 4.8.1. MySQL startup and automatic startup. <a href="#id-4-8-1-mysql-startup-and-automatic-startup" id="id-4-8-1-mysql-startup-and-automatic-startup"></a>

| **\[root\@xoonips-server \~]# /etc/init.d/mysqld start** | ← MySQL server startup.   |
| -------------------------------------------------------- | ------------------------- |
| **\[root\@xoonips-server \~]# chkconfig mysqld on**      | ← MySQL automatic startup |

## 4.8.2. Set a MySQL password and delete unnecessary data. <a href="#id-4-8-2-set-a-mysql-password-and-delete-unnecessary-data" id="id-4-8-2-set-a-mysql-password-and-delete-unnecessary-data"></a>

| **\[root\@xoonips-server \~]# mysql -uroot**                              | ← Log into the MySQL server as root user. |
| ------------------------------------------------------------------------- | ----------------------------------------- |
| Define the password for root user. (Example: mysqlroot\@pass)             |                                           |
| **mysql > set password for root\@localhost=password('mysqlroot\@pass');** |                                           |
| **mysql > delete from mysql.user where user='';**                         | ← Delete anonymous users.                 |
| **mysql > drop database test;**                                           | ← Delete test database.                   |

## 4.8.3. Create a database for XooNIps. <a href="#id-4-8-3-create-a-database-for-xoonips" id="id-4-8-3-create-a-database-for-xoonips"></a>

| Create a database for XooNIps and name it xoonipsdb.                                                     |                            |
| -------------------------------------------------------------------------------------------------------- | -------------------------- |
| **mysql > create database xoonipsdb character set ujis;**                                                |                            |
| Create it with the user name: xoonipsuser, the password: xoonips\@pass to access xoonipsdb.              |                            |
| **mysql > grant all privileges on xoonipsdb.\* to xoonipsuser\@localhost identified by'xoonips\@pass';** |                            |
| **mysql > exit**                                                                                         | ← Log out of MySQL server. |
