CentOS5.3にmySQL5.1.52をインストールする

このブログは【カミタニブログ】へ引っ越しました。当該記事はこちらになります。
お手数をおかけしますが、よろしくお願いいたします。


















今回もざっくり作業手順だけლ(・ิω・ิლ)

対象

  • CentOS5.3
  • mySQL5.1.52


今回はこちらの記事を参考にさせて頂きました。

あざます><

すでにインストールされてないか確認

mysqlがすでにないか確認。

yum list installed | grep mysql

ないので、mysql serverをインストール。

yum -y install mysql-server php-mysql

my.cnf編集

vi /etc/my.cnf

こちらの記事を参考にさせて頂きつつ、
文字コードUTF-8で設定。
※追記したもののみ記述してます><

[mysqld]
# add
default-character-set = utf8
skip-character-set-client-handshake

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

ただ、skip-character-set-client-handshakeに関しては

といった記事も見かけたので、また改めて勉強しよ。

mySQL起動

編集後、起動させます。

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

自動起動も行っておく。

chkconfig mysqld on

chkconfigコマンド叩いたあとはいつも通り
特に反応はなく、入力待ち状態になりました。


以上でインストール終了。
念の為、はいってみましょかね。

mysql -u root -p

※ここまでの流れではrootにパスワード設定をしていません。

入れました。

rootパスワードの設定

mysql_secure_installation

以下、対話形式でお送りします。

[root@localhost ~]# mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
# ※[Enter]キーを叩く

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] 
# ※[Y]キーを叩く(rootのパスワード設定する?)

New password: 
# ※パスワードを入力
Re-enter new password: 
# ※再度パスワードを入力
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
# ※[Y]キーを叩く(匿名ユーザを削除する?)

 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] 
# ※[Y]キーを叩く(リモートからのrootログインを禁止する?)

 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
# ※[Y]キーを叩く(testデータベースを削除する?)

 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 
# ※[Y]キーを叩く(権限テーブルをリロードする?)

 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

サンクス!


ひとまずこんな感じですლ(・ิω・ิლ)
...Success!ってなんかいいですね。かっけー


なお、mysqlの起動を確認するには

/usr/local/mysql/bin/mysqladmin ping -u root -p

起動していれば、
mysqld is alive
と表示されますえ。