|
[ CentOS/MySQL ] MySQL5 yum インストール †[root@linux ~]# yum install mysql-server ~ 中略 ~ ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: mysql-server i386 5.0.22-2.2.el5_1.1 updates 10 M Installing for dependencies: mysql i386 5.0.22-2.2.el5_1.1 updates 3.0 M perl-DBD-MySQL i386 3.0007-1.fc6 base 147 k perl-DBI i386 1.52-1.fc6 base 605 k Transaction Summary ============================================================================= Install 4 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 14 M Is this ok [y/N]: y ←■ yを入力、Enter ~ 中略 ~ Installing: perl-DBI ######################### [1/4] Installing: mysql ######################### [2/4] Installing: perl-DBD-MySQL ######################### [3/4] Installing: mysql-server ######################### [4/4] Installed: mysql-server.i386 0:5.0.22-2.2.el5_1.1 Dependency Installed: mysql.i386 0:5.0.22-2.2.el5_1.1 perl-DBD-MySQL.i386 0:3.0007-1.fc6 perl-DBI.i386 0:1.52-1.fc6 Complete! [root@linux ~]# MySQL データディレクトリのパス ⇒ /var/lib/mysql /etc/my.cnf 編集 †デフォルト文字コード追記
[root@linux ~]# cp -a /etc/my.cnf /etc/my.cnf.org ←■ バックアップ [root@linux ~]# vi /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 # 追記 default-character-set=utf8 skip-character-set-client-handshake ←■ クライアントの文字コードに依存しない [mysqld_safe] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [client] # 追記 default-character-set=utf8 [mysql] # 追記 default-character-set=utf8 [mysqldump] # 追記 default-character-set=utf8 サービス確認 †[root@linux ~]# chkconfig --list mysqld mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@a ~]# chkconfig mysqld on ←■ 自動起動ONにする [root@a ~]# chkconfig --list mysqld mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off ←■ 再確認 [root@linux ~]# MySQL 起動 †[root@linux ~]# /etc/rc.d/init.d/mysqld start MySQL データベースを初期化中: [ OK ] MySQL を起動中: [ OK ] [root@linux ~]# mysql |