※yumでインストールされるMySQLのバージョンが古いため、rpmからインストール
4.ログイン
- MySQL-server
- MySQL-client
- MySQL-devel
をダウンロードして、インストールする。
# cd /usr/local/src
# wget http://download.softagency.net/MySQL/Downloads/MySQL-5.5/MySQL-server-5.5.10-1.rhel5.i386.rpm
# wget http://download.softagency.net/MySQL/Downloads/MySQL-5.5/MySQL-client-5.5.11-1.rhel5.i386.rpm
# wget http://download.softagency.net/MySQL/Downloads/MySQL-5.5/MySQL-devel-5.5.11-1.rhel5.i386.rpm
# rpm -ihv MySQL*
準備中... ########################################### [100%]
1:MySQL-server ########################################### [ 33%]
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test databases and anonymous user created by default.
This is strongly recommended for production servers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
2:MySQL-client ########################################### [ 67%]
3:MySQL-devel ########################################### [100%]
#
1:MySQL-server ########################################### [ 33%]
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test databases and anonymous user created by default.
This is strongly recommended for production servers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
2:MySQL-client ########################################### [ 67%]
3:MySQL-devel ########################################### [100%]
#
2./etc/my.cnf編集
# cd /etc
# cp /usr/share/mysql/my-small.cnf /etc/my.cnf
# vi my.cnf
[mysqld]
→character-set-server = utf8
[mysqldump]
→default-character-set = utf8
[mysql]
→default-character-set = utf8
※MySQL5.5 では、[mysqld]にdefault-character-setの設定が使えない。
3.MySQL起動/停止
# /etc/rc.d/init.d/mysql start
Starting MySQL.. [ OK ]
# /etc/rc.d/init.d/mysql stop
# /etc/rc.d/init.d/mysql stop
Shutting down MySQL. [ OK ]
#
# mysql -u root
Welcome to the MySQL monitor.
※セキュリティ的な観点からパスワードの設定を行う。
Welcome to the MySQL monitor.
※セキュリティ的な観点からパスワードの設定を行う。
# mysqladmin -u root password 'XXXX'
# mysql -u root -p
# mysql -u root -p
Enter password: ←設定したパスワード
文字コード確認
mysql> show variables like 'character_set_%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)