2012年5月9日水曜日
MySQL5.1 install on CentOS 5 by yum
※this text from livedoor blog 2009/10/26
最近(2012/5)はMySQL5.5が入る筈
MySQL5.1をyumでインストールする
最新版のmysqlがremiに置いてあるので
remiレポジトリを追加する、remiレポジトリを追加するにはepelも要るので一緒に入れておく
プロセッサを調べる
$ uname -a
Linux ip-10-251-163-176 2.6.21.7-2.fc8xen-ec2-v1.0 #1 SMP Tue Sep 1 10:25:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
epel-release-X-X.noarch.rpmを探す
http://download.fedora.redhat.com/pub/epel/5/i386/
epel-release-5-4.noarch.rpmが見つかったとする
i386の場合
$ wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
$ wget http://rpms.famillecollet.com/el5.i386/remi-release-5-8.el5.remi.noarch.rpm
$ sudo rpm -Uvh epel-release-5-4.noarch.rpm
$ sudo rpm -Uvh remi-release-5-8.el5.remi.noarch.rpm
x86_64の場合
$ wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
$ wget http://rpms.famillecollet.com/el5.x86_64/remi-release-5-8.el5.remi.noarch.rpm
$ sudo rpm -Uvh epel-release-5-4.noarch.rpm
$ sudo rpm -Uvh remi-release-5-8.el5.remi.noarch.rpm
remiレポジトリを有効にする
$ sudo emacs /etc/yum.repos.d/remi.repo
[remi]
enabled=1
yumでインストールする
$ sudo yum install mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirror.averse.net
* base: mirror.averse.net
* epel: ftp.kddilabs.jp
* extras: mirror.averse.net
* remi: rpms.famillecollet.com
* updates: mirror.averse.net
remi | 2.3 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.i386 0:5.1.40-1.el5.remi set to be updated
--> Processing Dependency: mysql = 5.1.40-1.el5.remi for package: mysql-server
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16) for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16) for package: mysql-server
--> Processing Dependency: perl-DBI for package: mysql-server
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server
--> Processing Dependency: perl(DBI) for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.16 for package: mysql-server
--> Processing Dependency: libmysqlclient.so.16 for package: mysql-server
--> Running transaction check
---> Package mysql.i386 0:5.1.40-1.el5.remi set to be updated
---> Package mysql-libs.i386 0:5.1.40-1.el5.remi set to be updated
---> Package perl-DBD-MySQL.i386 0:3.0007-2.el5 set to be updated
--> Processing Dependency: libmysqlclient.so.15 for package: perl-DBD-MySQL
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: perl-DBD-MySQL
---> Package perl-DBI.i386 0:1.52-2.el5 set to be updated
--> Running transaction check
---> Package mysqlclient15.i386 0:5.0.67-1.el5.remi set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
mysql-server i386 5.1.40-1.el5.remi remi 11 M
Installing for dependencies:
mysql i386 5.1.40-1.el5.remi remi 3.9 M
mysql-libs i386 5.1.40-1.el5.remi remi 2.1 M
mysqlclient15 i386 5.0.67-1.el5.remi remi 1.3 M
perl-DBD-MySQL i386 3.0007-2.el5 base 148 k
perl-DBI i386 1.52-2.el5 base 600 k
Transaction Summary
=====================================================================================================================
Install 6 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 19 M
Is this ok [y/N]: y
インストールしたいバージョンであることを確認する
ベンチとmysql-develも入れておく
$ sudo yum install mysql-bench
$ sudo yum install mysql-devel
MySQLを起動する
$ sudo /etc/init.d/mysqld start
パスワードを設定する
$ /usr/bin/mysql -uroot
mysql> SET PASSWORD FOR root@localhost=PASSWORD('********');
mysql> SET PASSWORD FOR user@localhost=PASSWORD('********');