0. Description
The advantage of using the Yum installation is that you don't have to solve the dependencies between the software yourself, basically yum finishes, and the software is installed, and the Yum approach to installing MySQL is described below, as well as the security optimizations after the installation is complete.
Note: The following actions are demonstrated with the newly installed CentOS 6.5来.
1. Install MySQL with yum
[Email protected]]# yum List installed | grep MySQL
If you specify the installation of the MySQL database when installing CentOS, there will be a display, here I did not install MySQL.
[[email protected] ~]# yum-y install mysql-server mysql mysql-devel
Note on your system to see the message after the installation is successful.
[[email protected] ~]# yum list installed | grep mysqlmysql.x86_64 5.1.73-5.el6_6 @base mysql-devel.x86_64 5.1.73-5.el6_6 @base mysql-libs.x86_64 5.1.73-5.el6_6 @base mysql-server.x86_64 5.1.73-5.el6_6 @base
[[Email protected] ~]# service mysqld startstarting mysqld: [OK]
[Email protected] ~]# Mysqlwelcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 4Server version:5.1.73 Source distributioncopyright (c), +, Oracle and/or its a Ffiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql>
In fact, if the non-production environment requirements, like the above using yum simple installation can be, of course, if used in the production environment, then it is recommended to use the source code installation.
2.MySQL Security Optimization
As for why to security optimization, you can read the blogger written by the source of the installation of MySQL blog: "On the CentOS source installation mysql+ installation problem solving + security optimization"
The following steps are given directly to the operation. (Note: To ensure that the MySQL service is turned on, the method is already given above)
(1) Create a password for the root user
[[email protected] ~]# mysql-u rootmysql> update mysql.user Set password = password (' 123456 ') where user = ' root '; Query OK, 3 Rows Affected (0.00 sec) rows Matched:3 changed:3 warnings:0mysql> flush privileges; Query OK, 0 rows Affected (0.00 sec)
The password ' 123456 ' is created for the root user.
(2) Delete anonymous users
[Email protected] ~]# mysql-u root-penter password:mysql>
mysql> DROP USER ' @ ' localhost '; Query OK, 0 rows Affected (0.00 sec) mysql> DROP USER ' @ ' leaf '; Query OK, 0 rows Affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows Affected (0.00 sec)
Note the ' leaf ' of the second DELETE statement, where the ' leaf ' is my hostname and can be operated according to your actual situation.
After executing the above (1) (2) step, check the current account information:
Mysql> Select User, Host, Password from Mysql.user; +------+-----------+-------------------------------------------+| User | Host | Password |+------+-----------+-------------------------------------------+| Root | localhost | *6bb4837eb74329105ee4568dda7dc67ed2ca2ad9 | | Root | Leaf | *6bb4837eb74329105ee4568dda7dc67ed2ca2ad9 | | Root | 127.0.0.1 | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |+------+-----------+-------------------------------------------+3 Rows in Set (0.00 sec)
(3) Delete the test database or the database whose name begins with test
The operation is as follows:
Mysql> Delete from the mysql.db where db like ' test% '; Query OK, 2 rows Affected (0.00 sec) mysql> drop database test; Query OK, 0 rows Affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows Affected (0.00 sec)
OK, in this case, using Yum to install MySQL and MySQL basic security optimization is complete, there should be no too much problem.
This article is from the "fragrant fluttering leaves" blog, please make sure to keep this source http://xpleaf.blog.51cto.com/9315560/1748625
Use Yum to install mysql+ security optimizations on CentOS