HOME > Magento 構築TIPS > 1.MySQLのインストール

TIPS

1.MySQLのインストール

1.1.インストール

% su -
# yum -y install mysql-server
# yum -y install php php-mbstring php-mysql

1.2.MySQL設定ファイル編集

# vi /etc/my.cnf

・my.cnf

default-character-set = utf8

*上記を末尾に追記します。

1.3.MySQL起動

# /etc/rc.d/init.d/mysqld start

1.4.MySQL自動起動設定

# chkconfig mysqld on
# chkconfig --list mysqld
# mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

1.5.MySQLデータベース初期設定

# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.45 Source distribution

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

mysql> select user,host,password from mysql.user;
+------+--------------------+----------+
| user | host               | password |
+------+--------------------+----------+
| root | localhost          |          |
| root | 127.0.0.1          |          |
+------+--------------------+----------+
2 rows in set (0.00 sec)

mysql>set password for root@localhost=password('************');
Query OK, 0 rows affected (0.00 sec)
mysql>set password for root@127.0.0.1=password('************');
Query OK, 0 rows affected (0.00 sec)

mysql> select user,host,password from mysql.user;
+------+--------------------+------------------+
| user | host               | password         |
+------+--------------------+------------------+
| root | localhost          | 2b78883854849046 |
| root | 127.0.0.1          | 2b78883854849046 |
+------+--------------------+------------------+
3 rows in set (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

mysql> drop database test;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> exit