# 4.8. MySQLの設定

XooNIpsで使用するDatabaseシステムの設定を行います。

| `[root@xoonips-server ~]#` **vi /etc/my.cnf** | ← 設定ファイルの編集 |
| --------------------------------------------- | ----------- |
| **\[mysqld]**&#x30BB;クションに以下の2行を追加します。        |             |
| **default-character-set=ujis**                |             |
| **skip-character-set-client-handshake**       |             |

## 4.8.1. **MySQLの起動と自動起動設定** <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サーバ起動 |
| ------------------------------------------------------- | ------------ |

| `[root@xoonips-server ~]#` **chkconfig mysqld on** | ← MySQL自動起動設定 |
| -------------------------------------------------- | ------------- |

## 4.8.2. **MySQLパスワードの設定と不要データの削除** <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**                                 | ← MySQLサーバへrootユーザでログイン |
| --------------------------------------------------------------------------- | ----------------------- |
| rootユーザのパスワードを設定(例はmysqlroot\@pass)                                         |                         |
| `mysql >` **set password for root\@localhost=password('mysqlroot\@pass');** |                         |
| `mysql >` **delete from mysql.user where user='';**                         | ← 匿名ユーザを削除します。          |
| `mysql >` **drop database test;**                                           | ← testデータベースの削除         |

## 4.8.3. **XooNIps用データベースの作成** <a href="#id-4-8-3-create-a-database-for-xoonips" id="id-4-8-3-create-a-database-for-xoonips"></a>

| xoonipsdbという名前でXooNIps用のデータベースを作成します。                                                                      |                      |
| ---------------------------------------------------------------------------------------------------------- | -------------------- |
| `mysql >` **create database xoonipsdb character set ujis;**                                                |                      |
| xoonipsdbにアクセスするユーザxoonipsuser,パスワードxoonips\@passで作成します。                                                   |                      |
| `mysql >` **grant all privileges on xoonipsdb.\* to xoonipsuser\@localhost identified by'xoonips\@pass';** |                      |
| `mysql >` **exit**                                                                                         | ← MySQLサーバからログアウトする。 |


---

# 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/jp/3installation/4-centos5nokasutamaizu/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.
