2014/05/23 (Fri)
CentOS 6.5にMySQL5.7をyumでインストールする
覚え書きです。
OSバージョン確認
[root@localhost ~]# cat /etc/redhat-release CentOS release 6.5 (Final) [root@localhost ~]# arch x86_64
ミラーサーバー http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.7/ を開き、末尾が".el6.x86_64.rpm"のもののうち、以下の三つのリンクURLをコピーする
- MySQL-shared-compat-***.el6.x86_64.rpm
- MySQL-client-***.el6.x86_64.rpm
- MySQL-server-***.el6.x86_64.rpm
yumコマンドで順次インストール。*1 MySQL-shared-compatから順にインストールしていけば、古いmysql-libsとコンフリクトすることもないですよ。
[root@localhost ~]# yum -y install http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.7/MySQL-shared-compat-5.7.4_m14-1.el6.x86_64.rpm [root@localhost ~]# yum -y install http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.7/MySQL-client-5.7.4_m14-1.el6.x86_64.rpm [root@localhost ~]# yum -y install http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.7/MySQL-server-5.7.4_m14-1.el6.x86_64.rpm
MySQL-serverをインストールすると、以下のようなメッセージが出ます。
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER ! You will find that password in '/root/.mysql_secret'. You must change that password on your first connect, no other statement but 'SET PASSWORD' will be accepted. See the manual for the semantics of the 'password expired' flag.
/root/.mysql_secret に初期rootパスワードが書き出されているので、MySQLを起動後、それでログインして、rootパスワードを書き換えます。
[root@localhost ~]# cat /root/.mysql_secret # The random password set for the root user at Thu May 22 21:11:27 2014 (local time): C4={X-@0.dta(yfd [root@localhost ~]# service mysql start Starting MySQL... [ OK ] [root@localhost ~]# chkconfig mysql on [root@localhost ~]# chkconfig --list mysql mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@localhost ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.7.4-m14 mysql> SET PASSWORD FOR root@localhost=PASSWORD('hello2014'); Query OK, 0 rows affected (0.03 sec) mysql> quit Bye
MySQLのrootのパスワードをhello2014に書き換え*2、再度ログインできることを確認。
[root@localhost ~]# mysql -u root -p
Enter password:
コメント
トラックバック - http://program.g.hatena.ne.jp/halflite/20140523