CentOSにMySQLをインストール

同じようなことばかり書いてる。
yumを使ってインストールするだけなので特にメモの必要はないかなと思いますが、PHP拡張モジュールの設定も必要なので備忘。

 yum install mysql php-mysql

これで現時点では以下バージョンが入りました。

# yum info mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: rsync.atworks.co.jp
 * updates: rsync.atworks.co.jp
 * centosplus: rsync.atworks.co.jp
 * addons: rsync.atworks.co.jp
 * extras: rsync.atworks.co.jp
Installed Packages
Name       : mysql
Arch       : i386
Version    : 5.0.45
Release    : 7.el5
Size       : 7.3 M
Repo       : installed
Summary    : MySQL のクライアントプログラムと共有ライブラリ。
URL        : http://www.mysql.com
License    : GPLv2 with exceptions
Description: MySQL is a multi-user, multi-threaded SQL database server. MySQL is a client/server implementation consisting of a server daemon (mysqld)
           : and many different client programs and libraries. The base package contains the MySQL client programs, the client shared libraries, and
           : generic MySQL files.
# yum info php-mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: rsync.atworks.co.jp
 * updates: rsync.atworks.co.jp
 * centosplus: rsync.atworks.co.jp
 * addons: rsync.atworks.co.jp
 * extras: rsync.atworks.co.jp
Installed Packages
Name       : php-mysql
Arch       : i386
Version    : 5.1.6
Release    : 23.2.el5_3
Size       : 175 k
Repo       : installed
Summary    : MySQL データベースを使用した PHP アプリケーション用のモジュール
URL        : http://www.php.net/
License    : The PHP License v3.01
Description: The php-mysql package contains a dynamic shared object that will add MySQL database support to PHP. MySQL is an object-relational
           : database management system. PHP is an HTML-embeddable scripting language. If you need MySQL support for PHP applications, you will need
           : to install this package and the php package.

php.iniにもMySQLモジュールが自動で設定されてるのかな?とphp.iniを確認しましたが、どうやらphp.iniは更新されているようでした。多分php-mysqlをインストールした場合は普通はphp.iniを確認すると思うのでこれは便利かな。Windowsではレジストリとか更新されてるとぜんぜん追えないし。

しかし、これだとサーバーが入っていないので、追加でmysql-serverを入れる必要があるのに気づきましたので入れます。

# yum install mysql-server

そしてMySQLの設定ファイル/etc/my.cnfに以下追記
(参照:データベースサーバー構築(MySQL)

default-character-set = utf8
 
[mysql]
default-character-set = utf8

そして起動します。

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

今日はこのくらいで。


Leave a Reply