トップ   編集 凍結解除 差分 バックアップ 添付 複製 名前変更 リロード   一覧 最終更新   ヘルプ   最終更新のRSS
 


動作確認ディストリビューション

MySQL 4.1のインストール

インストール

# yum -y install mysql-server

...省略...

Running Transaction
  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:4.1.22-2.el4
Dependency Installed: mysql.i386 0:4.1.22-2.el4 perl-DBD-MySQL.i386 0:2.9004-3.1.centos4 perl-DBI.i386 0:1.40-9
Complete!

MySQLの自動起動設定

# chkconfig mysqld on
# chkconfig --list mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

MySQLサービス起動

# service mysqld start
MySQL データベースを初期化中:                              [  OK  ]
MySQL を起動中:                                            [  OK  ]

MySQLサービス確認

# netstat -at |grep mysql

DB初期設定

# 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): ← 空エンター押下
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] ← 空エンター押下
New password: ← rootユーザーのパスワードを入力
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] ← 空エンター押下(匿名ユーザーを削除)
 ... 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] ← 空エンター押下(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] ← 空エンター押下(「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] ← 空エンター押下(設定を反映)
 ... 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!

接続確認

# mysql -u root -p
Enter password: ←上記の初期設定にて設定したrootユーザーのパスワードを入力
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 16 to server version: 4.1.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

接続確認が完了後、切断処理

mysql> quit ←「quit」と入力し、エンター押下
Bye

ちなみに、上記の初期設定は、以前は以下のような手順で行っていました。恐らくこのバージョンでも同様の手順で設定可能だと思います。(試してません)
rootユーザーのパスワード及びアクセス制限設定

# su - mysql
$ mysql -u root mysql
mysql> grant all on *.* to root@localhost identified by 'rootユーザーのパスワード';
mysql> flush privileges;

匿名ユーザーの削除

mysql> delete from user where user='';
mysql> flush privileges;

「test」データベース削除

mysql> drop database test;
mysql> flush privileges;

Last-modified: 2009-04-11 (土) 12:49:25 (3539d)