[MySQL][Database]
# yum install mysql-server
# /etc/rc.d/init.d/mysqld start
# mysql -u root -p
mysql> set password for 'root'@'localhost' = password('newpassword');
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'root'@'krishna.typea.info' = password('newpassword');
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'root'@'127.0.0.1' = password('newpassword');
Query OK, 0 rows affected (0.00 sec)
mysql> create user piroot@"%";
Query OK, 0 rows affected (0.00 sec)
mysql> create user piroot@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'piroot'@'localhost' = password('newpassword');
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'piroot'@'%' = password('newpassword');
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to piroot@localhost identified by 'newpassword' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to piroot@"%" identified by 'newpassword' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> grant create,select,insert,update,delete on *.* to piroot@localhost identified by 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> grant create,select,insert,update,delete on *.* to piroot@"%" identified by 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> grant create,select,insert,update,delete on *.* to piroot@"%" identified by 'password';
Query OK, 0 rows affected (0.00 sec)
- 確認
mysql> select host, user from mysql.user;
+--------------------+--------+
| host | user |
+--------------------+--------+
| % | piroot |
| 127.0.0.1 | root |
| krishna.typea.info | |
| krishna.typea.info | root |
| localhost | |
| localhost | piroot |
| localhost | root |
+--------------------+--------+
7 rows in set (0.00 sec)
- データベースの作成
mysql> create database mt character set utf8;
Query OK, 1 row affected (0.10 sec)
YAGI Hiroto (piroto@a-net.email.ne.jp)
twitter http://twitter.com/pppiroto
Copyright© 矢木 浩人 All Rights Reserved.