ソスfソス[ソス^ソスxソス[ソスXソスTソス[ソスoソス[ソス\ソスz(MySQL)

ソスナ終ソスXソスVソスソスソスF 2014.02.19

<<ソスgソスbソスvソスyソス[ソスW <<ソスVソスソスソスソスソス <<ソスTソスCソスgソスソスソスソスソスソス <<CentOSソスナ趣ソスソスソスTソス[ソスoソス[ソス\ソスz <<Scientific Linuxソスナ趣ソスソスソスTソス[ソスoソス[ソス\ソスz

ソスソスソスTソスv

ソスfソス[ソス^ソスxソス[ソスXソスTソス[ソスoソス[ソスヘ、ソスTソス[ソスoソス[ソスソスノ作成ソスソスソスソスソスfソス[ソス^ソスxソス[ソスXソスソスソスfソス[ソス^ソスxソス[ソスXソスヌ暦ソスソスVソスXソスeソスソスソスソスソスしソストクソスソスソスCソスAソスソスソスgソスソスソス迹ソスソスナゑソスソスソス謔、ソスノゑソスソス驍スソス゚のサソス[ソスoソス[ソスB
ソスソスソスソスソスナは、ソスtソスソスソス[ソスフソスソスソスソス[ソスVソスソスソスiソスソスソスfソス[ソス^ソスxソス[ソスXソスTソス[ソスoソス[ソスナゑソスソスソスMySQLソスソスソスgソスpソスソスソスソスB


ソスソスMySQLソスCソスソスソスXソスgソス[ソスソス

[root@fedora ~]# yum -y install mysql-serverソス@ソスソスソス@mysql-serverソスCソスソスソスXソスgソス[ソスソス

ソスソスMySQLソスン抵ソス

[root@fedora ~]# vi /etc/my.cnfソス@ソスソスソス@MySQLソスン抵ソスtソス@ソスCソスソスソスメ集
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server = utf8ソス@ソスソスソス@ソスヌ会ソス(MySQLソスTソス[ソスoソス[ソスフ包ソスソスソスソスRソス[ソスhソスソスUTF-8ソスノゑソスソスソス)

ソスソスMySQLソスNソスソス

[root@fedora ~]# /etc/rc.d/init.d/mysqld startソス@ソスソスソス@MySQLソスNソスソス
Starting mysqld (via systemctl):                           [  OK  ]

[root@fedora ~]# chkconfig mysqld onソス@ソスソスソス@MySQLソスソスソスソスソスNソスソスソスン抵ソス


ソスソスMySQLソスソスソスソスソスン抵ソス

[root@fedora ~]# mysql_secure_installationソス@ソスソスソス@MySQLソスソスソスソスソスン抵ソス




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] ソス@ソスソスソス@ソスソスENTER(rootソスpソスXソスソスソス[ソスhソスン抵ソス)
New password: ソス@ソスソスソス@rootソスpソスXソスソスソス[ソスhソスソスソスソス
Re-enter new password: ソス@ソスソスソス@rootソスpソスXソスソスソス[ソスhソスソスソスソス(ソスmソスF)
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] ソス@ソスソスソス@ソスソスENTER(ソスソスソスソスソスソスソス[ソスUソス[ソス除)
 ... 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] ソス@ソスソスソス@ソスソスENTER(ソスソスソスソスソス[ソスgソスソスソスソスソスrootソスソスソスOソスCソスソスソスヨ止)
 ... 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] ソス@ソスソスソス@ソスソスENTER(testソスfソス[ソス^ソスxソス[ソスXソス除)
 - 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] ソス@ソスソスソス@ソスソスENTER
 ... 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ソスmソスF

[root@fedora ~]# mysql -u root -pソス@ソスソスソス@MySQLソスソスrootソスナソスソスOソスCソスソス
Enter password: ソス@ソスソスソス@MySQLソスソスrootソスpソスXソスソスソス[ソスhソスソスソスソス
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.21

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


mysql> grant all privileges on test.* to fedora@localhost identified by 'fedorapass';
ソス@ソスソスソス@testソスfソス[ソス^ソスxソス[ソスXソスヨの全ソストのアソスNソスZソスXソスソスソスソスソスソスソスソスソスソスソスソスソスAソスVソスKソスソスソス[ソスUfedoraソスソスoソス^
Query OK, 0 rows affected (0.00 sec)

mysql> select user from mysql.user where user='fedora';ソス@ソスソスソス@fedoraソスソスソス[ソスUソスoソス^ソスmソスF
+--------+
| user   |
+--------+
| fedora |
+--------+
1 row in set (0.00 sec)

mysql> exitソス@ソスソスソス@ソスソスソスOソスAソスEソスg
Bye

[root@fedora ~]# mysql -u fedora -pfedorapassソス@ソスソスソス@fedoraソスソスソス[ソスUソスソスMySQLソスTソス[ソスoソス[ソスヨソスソスOソスCソスソス
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.21

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

mysql> create database test;ソス@ソスソスソス@testソスfソス[ソス^ソスxソス[ソスXソス成
Query OK, 1 row affected (0.00 sec)

mysql> show databases;ソス@ソスソスソス@ソスfソス[ソス^ソスxソス[ソスXソス成ソスmソスF
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.00 sec)

mysql> use testソス@ソスソスソス@testソスfソス[ソス^ソスxソス[ソスXソスヨ接托ソス
Database changed

mysql> create table test(num int, name varchar(50));ソス@ソスソスソス@testソスeソス[ソスuソスソスソス成
Query OK, 0 rows affected (0.01 sec)

mysql> show tables;ソス@ソスソスソス@ソスeソス[ソスuソスソスソス成ソスmソスF
+----------------+
| Tables_in_test |
+----------------+
| test           |
+----------------+
1 row in set (0.00 sec)

mysql> insert into test values(1,'ソスRソスcソスソスソスY');ソス@ソスソスソス@testソスeソス[ソスuソスソスソスヨデソス[ソス^ソスoソス^
Query OK, 1 row affected (0.00 sec)

mysql> select * from test;ソス@ソスソスソス@ソスfソス[ソス^ソスoソス^ソスmソスF
+------+----------+
| num  | name     |
+------+----------+
|    1 | ソスRソスcソスソスソスY |
+------+----------+
1 row in set (0.00 sec)

mysql> update test set name='ソスRソスcソスソスソスY';ソス@ソスソスソス@testソスeソス[ソスuソスソスソスソスソスfソス[ソス^ソスXソスV
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from test;ソス@ソスソスソス@ソスfソス[ソス^ソスXソスVソスmソスF
+------+----------+
| num  | name     |
+------+----------+
|    1 | ソスRソスcソスソスソスY |
+------+----------+
1 row in set (0.01 sec)

mysql> delete from test where num=1;ソス@ソスソスソス@testソスeソス[ソスuソスソスソスソスソスfソス[ソス^ソス除
Query OK, 1 row affected (0.03 sec)

mysql> select * from test;ソス@ソスソスソス@ソスfソス[ソス^ソス除ソスmソスF
Empty set (0.00 sec)

mysql> drop table test;ソス@ソスソスソス@testソスeソス[ソスuソスソスソス除
Query OK, 0 rows affected (0.00 sec)

mysql> show tables;ソス@ソスソスソス@ソスeソス[ソスuソスソスソス除ソスmソスF
Empty set (0.00 sec)

mysql> drop database test;ソス@ソスソスソス@ソスfソス[ソス^ソスxソス[ソスXtestソス除
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;ソス@ソスソスソス@ソスfソス[ソス^ソスxソス[ソスXソス除ソスmソスF
+--------------------+
| Database           |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)

mysql> exitソス@ソスソスソス@ソスソスソスOソスAソスEソスg
Bye

[root@fedora ~]# mysql -u root -pソス@ソスソスソス@MySQLソスソスrootソスナソスソスOソスCソスソス
Enter password: ソス@ソスソスソス@MySQLソスソスrootソスpソスXソスソスソス[ソスhソスソスソスソス
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.21

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

mysql> revoke all privileges on *.* from fedora@localhost;ソス@ソスソスソス@fedoraソスソスソス[ソスUソスソスソスソスSソストのデソス[ソス^ソスxソス[ソスXソスヨのアソスNソスZソスXソスソスソスソスソス剥奪
Query OK, 0 rows affected (0.00 sec)

mysql> delete from mysql.user where user='fedora' and host='localhost';ソス@ソスソスソス@fedoraソスソスソス[ソスUソス除
Query OK, 1 row affected (0.01 sec)

mysql> select user from mysql.user where user='fedora';ソス@ソスソスソス@fedoraソスソスソス[ソスUソス除ソスmソスF
Empty set (0.00 sec)

mysql> flush privileges;ソス@ソスソスソス@fedoraソスソスソス[ソスUソスフ削除ソスソスMySQLソスTソス[ソスoソス[ソスヨ費ソスソスf
Query OK, 0 rows affected (0.01 sec)

mysql> exitソス@ソスソスソス@ソスソスソスOソスAソスEソスg
Bye


ソスソスソスヨ連ソスRソスソスソスeソスソスソスc

<!ソス\ソスeソスLソスXソスgソスフみゑソス4ソスsソス\ソスソスソスノ追会ソスソスソスCソスソスソスソスソスソス\>



ソスソスソスソスソスフペソス[ソスWソスフトソスbソスvソスヨ戻ゑソス

ソスvソスソスソスCソスoソスVソス[ソス|ソスソスソスVソス[