首页 > 代码库 > 二进制方式安装mysql-5.6.16

二进制方式安装mysql-5.6.16

一、检查系统版本
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)

 

二、添加用户与组

# groupadd mysql
# useradd -g mysql mysql

 

三、安装MySQL到/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

 

四、修改mysql目录的所有者和所属组位mysql

# chown -R mysql:mysql  mysql/ .

 

五、初始化
#scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 初始化
#cp support-files/mysql.server /etc/init.d/mysqld 


六、修改配置文件
#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


七、启动mysql服务
#ln -s /usr/local/mysql/bin/mysql /usr/bin 软链接
#service mysqld start


八、登陆mysql并且删除空用户
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;

二进制方式安装mysql-5.6.16