First, check the system version
# Cat/etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)
Second, add users and Groups
# Groupadd MySQL
# useradd-g MySQL MySQL
Third, install MySQL to/usr/local/mysql
#cd/usr/local
#tar ZXVF mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz
#mv Mysql-5.6.16-linux-glibc2.5-x86_64/mysql
Iv. modifying the MySQL directory owner and owning the group bit MySQL
# chown-r Mysql:mysql mysql/.
V. Initialization
#scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data Initialization
#cp Support-files/mysql.server/etc/init.d/mysqld
Vi. Modifying configuration files
#cp/usr/local/mysql/my.cnf/etc/my.cnf
#vim/etc/my.cnf
[Mysqld]
Basedir =/usr/local/mysql
DataDir =/usr/local/mysql/data
Port = 3306
server_id = 1
Socket =/tmp/mysql.sock
[Client]
Socket =/tmp/mysql.sock
Seven, start the MySQL service
#ln-S/usr/local/mysql/bin/mysql/usr/bin soft links
#service mysqld Start
Eight, login MySQL and delete empty user
mysql> Select User,host,password from Mysql.user;
+------+-----------+----------+
| user | Host | password |
+------+-----------+----------+
| root | localhost | |
| root | mysql | |
| root | 127.0.0.1 | |
| root |:: 1 | |
| | localhost | |
| | mysql | |
+------+-----------+----------+
6 Rows in Set (0.00 sec)
mysql> UPDATE mysql.user Set password = password (' gechong ') WHERE user = ' root ';
mysql> DROP USER ' @localhost;
mysql> FLUSH privileges;
Binary mode installation mysql-5.6.16