サービスご利用中のお客さま

VPSならラピッドサイト。VPS(仮想専用サーバー)販売14年の実績!

01) MySQL

MySQL

RV-7シリーズでは標準でMysqlがご利用いただけます。

バージョン確認

[root@linux ~]# mysql -V
mysql Ver 14.7 Distrib 4.1.20, for redhat-linux-gnu (i386) using readline 4.3

オプション設定ファイル(/etc/my.cnf)

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

default-character-set = utf8

[client]
default-character-set = utf8

[mysqldump]
default-character-set = utf8

[mysql]
default-character-set = utf8

起動スクリプト

引数一覧
start起動
stop停止
statusステータス確認
condrestart起動確認後に再起動
restart再起動
実行例
MySQLの起動スクリプト"/etc/init.d/mysql"は引数によって処理が異なります。

[root@linux ~]# /etc/init.d/mysql condrestart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]

[root@linux ~]# /etc/init.d/mysql stop
Stopping MySQL: [ OK ]

[root@linux ~]# /etc/init.d/mysql start
Starting MySQL: [ OK ]

[root@linux ~]# /etc/init.d/mysql status
mysqld (pid 9352) is running...

※MySQLの起動スクリプト名はご契約時期により以下の場合がございます。
/etc/init.d/mysql

MySQLクライアント

ログイン
[root@linux /]# mysql -u USERNAME -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 24 to server version: 4.1.20

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
データベース一覧
mysql> show databases;
+-----------+
| Database |
+-----------+
| eccube_db |
| mt |
| mysql |
| openpne |
| test |
| xoops |
+-----------+
6 rows in set (0.10 sec)
データベース作成
mysql> create database volvic;
Query OK, 1 row affected (1.30 sec)

mysql> show databases;
+-----------+
| Database |
+-----------+
| eccube_db |
| mt |
| mysql |
| openpne |
| test |
| volvic |
| xoops |
+-----------+
7 rows in set (0.00 sec)
データベースバックアップ(sqlファイルに保存)
[root@linux /]# mysqldump -u root -p volvic > volvic.sql
Enter password: ********

[root@linux /]# ls -la volvic.sql
-rw-r--r-- 1 root root 1047 May 30 14:32 volvic.sql
データベース復元
[root@linux /]# mysql -u root -p < volvic.sql
Enter password: ********
データベース削除
mysql> drop database volvic;
Query OK, 0 rows affected (1.57 sec)

phpMyAdminのURL

http://DOMAIN-NAME.COM/mysqladmin/

phpMyAdminはMysqlコマンドを使用せずWEBインターフェイスからMysqlの操作を可能とします。


ページの先頭へ戻る