[Home][Back][Next]

1.MySQLのインストール

# yum -y install mysql-server
Setting up Install Process
Setting up Repos
base 100% |=========================| 1.1 kB 00:00
updates-released 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
base : ################################################## 2622/2622
primary.xml.gz 100% |=========================| 346 kB 00:00
MD Read : ################################################## 866/866
updates-re: ################################################## 866/866
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for mysql-server to pack into transaction set.
mysql-server-3.23.58-16.F 100% |=========================| 20 kB 00:00
---> Package mysql-server.i386 0:3.23.58-16.FC3.1 set to be updated
--> Running transaction check
--> Processing Dependency: libmysqlclient.so.10 for package: mysql-server
--> Processing Dependency: mysql = 3.23.58 for package: mysql-server
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for mysql to pack into transaction set.
mysql-3.23.58-16.FC3.1.i3 100% |=========================| 36 kB 00:00
---> Package mysql.i386 0:3.23.58-16.FC3.1 set to be updated
--> Running transaction check
--> Processing Dependency: perl-DBI for package: mysql
--> Processing Dependency: perl-DBD-MySQL for package: mysql
--> Processing Dependency: perl(DBI) for package: mysql
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for perl-DBI to pack into transaction set.
perl-DBI-1.40-5.i386.rpm 100% |=========================| 11 kB 00:00
---> Package perl-DBI.i386 0:1.40-5 set to be updated
---> Downloading header for perl-DBD-MySQL to pack into transaction set.
perl-DBD-MySQL-2.9003-5.i 100% |=========================| 5.3 kB 00:00
---> Package perl-DBD-MySQL.i386 0:2.9003-5 set to be updated
--> Running transaction check

Dependencies Resolved
Transaction Listing:
Install: mysql-server.i386 0:3.23.58-16.FC3.1 - updates-released

Performing the following to resolve dependencies:
Install: mysql.i386 0:3.23.58-16.FC3.1 - updates-released
Install: perl-DBD-MySQL.i386 0:2.9003-5 - base
Install: perl-DBI.i386 0:1.40-5 - base
Total download size: 5.1 M
Downloading Packages:
(1/4): mysql-server-3.23. 100% |=========================| 1.3 MB 00:05
(2/4): perl-DBI-1.40-5.i3 100% |=========================| 467 kB 00:00
(3/4): mysql-3.23.58-16.F 100% |=========================| 3.2 MB 00:15
(4/4): perl-DBD-MySQL-2.9 100% |=========================| 111 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: perl-DBI 100 % done 1/4
Installing: mysql 100 % done 2/4
Installing: mysql-server 100 % done 3/4
Installing: perl-DBD-MySQL 100 % done 4/4

Installed: mysql-server.i386 0:3.23.58-16.FC3.1
Dependency Installed: mysql.i386 0:3.23.58-16.FC3.1 perl-DBD-MySQL.i386 0:2.9003
-5 perl-DBI.i386 0:1.40-5
Complete!

# yum clean packages
Cleaning up Packages
5 packages removed

2.MySQLの起動

# /etc/init.d/mysqld start
MySQL データベースを初期化中: [ OK ]
MySQL を起動中: [ OK ]

3.MySQLの自動起動設定

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

4.MySQLの設定

rootユーザのパスワード設定
# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 3.23.58

Type 'help;' or '\h' for help. Type '\c' to clear the buffer
mysql> select user,host,password from mysql.user; 
+------+----------------------+----------+
| user | host                 | password |
+------+----------------------+----------+
| root | localhost            |          |
| root | den08.kkataru.mine.mu |         |
|      | localhost            |          |
|      | den08.kkataru.mine.nu |         |
+------+----------------------+----------+
4 rows in set (0.00 sec)
mysql> set password for root@localhost=password('****');
Query OK, 0 rows affected (0.00 sec)

mysql> set password for root@'den08.kkataru.mine.nu'=password('****');
Query OK, 0 rows affected (0.01 sec)

mysql> select user,host,password from mysql.user; 
+------+----------------------+------------------+
| user | host                 | password         |
+------+----------------------+------------------+
| root | localhost            | **************** |
| root | den08.kkataru.mine.nu| **************** |
|      | localhost            |                  |
|      | den08.kkataru.mine.nu|                  |
+------+----------------------+------------------+
4 rows in set (0.00 sec)

mysql> exit
Bye





登録ユーザ、パスワード確認




ローカルホストのrootにパスワードが設定されていない
自ホストのrootにパスワードが設定されていない



匿名ユーザの削除
# mysql -u root -p****
mysql> select user,host from mysql.user;

+------+----------------------+
| user | host                 |
+------+----------------------+
|      | den08.kkataru.mine.nu |
| root | den08.kkataru.mine.nu |
|      | localhost            |
| root | localhost            |
+------+----------------------+
4 rows in set (0.00 sec)

> delete from mysql.user where user='';
Query OK, 2 rows affected (0.01 sec)

mysql> select user,host from mysql.user;
+------+----------------------+
| user | host                 |
+------+----------------------+
| root | den08.kkataru.mine.nu|
| root | localhost            |
+------+----------------------+
2 rows in set (0.00 sec)

mysql> exit
Bye

# mysql -u root -p****

mysql> grant usage on *.* to guest@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> select user,host,password from mysql.user;
+-------+----------------------+------------------+
| user  | host                 | password         |
+-------+----------------------+------------------+
| root  | localhost            | **************** |
| root  | den08.kkataru.mine.nu| **************** |
| guest | localhost            |                  |
+-------+----------------------+------------------+
3 rows in set (0.00 sec)

mysql> select * from mysql.user\G;

*************************** 3. row ***************************
Host: localhost
User: guest
Password:
Select_priv: N
Insert_priv: N
Update_priv: N
Delete_priv: N
Create_priv: N
Drop_priv: N
Reload_priv: N
Shutdown_priv: N
Process_priv: N
File_priv: N
Grant_priv: N
References_priv: N
Index_priv: N
Alter_priv: N
3 rows in set (0.00 sec)

mysql> exit
Bye

RESPONSE=`/usr/bin/mysqladmin -uUNKNOWN_MYSQL_USER ping 2>&1` &&
break
(以下のように変更)
RESPONSE=`/usr/bin/mysqladmin -u guet ping 2>&1` && break


# /etc/init.d/mysqld restart
MySQL を停止中: [ OK ]
MySQL を起動中: [ OK ]


[Home][Back][Next]

Copyright (C) 2005 ataru