# 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. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xoops.gitbook.io/xoonips-tutorial/3installation/4.-customize-centos5/48setup_for_mysql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
