下载安装包
由于官网访问及版本选择下载不太方便,使用 suho 的源进行下载
http://mirrors.sohu.com/mysql/MySQL-5.6/
下载如下三个安装包:
MySQL-server-5.6.24-1.el6.x86_64.rpm
MySQL-client-5.6.24-1.el6.x86_64.rpm
MySQL-devel-5.6.24-1.el6.x86_64.rpm
进行安装
如原装有mysql 请在安装前先进行卸载
[root@test1 files]# rpm -qa | grep mysql
[root@test1 files]# yum remove -y mysql-libs-5.1.-.el6_3.x86_64
[root@test1 files]# rm MySQL-server-5.6.-.el6.x86_64.rpm ... [root@test1 files]# rpm -ivh MySQL-client-5.6.-.el6.x86_64.rpm
Preparing... ########################################### [%]
:MySQL-client ########################################### [%]
[root@test1 files]# rpm -ivh MySQL-devel-5.6.-.el6.x86_64.rpm
Preparing... ########################################### [%]
:MySQL-devel ########################################### [%]
启动 mysql start 启动 stop 停止 restart 重启
[root@test1 files]# service mysql start
Starting MySQL. SUCCESS!
查看是否开机启动,设置为开机启动
[root@test1 files]# chkconfig --list | grep mysql
[root@test1 files]# chkconfig mysql on
开通远程权限 root 为用户 123456 为密码,防火墙需要开通3306 端口进入mysql
>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
>FLUSH privileges;
进入出错处理:
mysqld_safe --skip-grant-tables &
mysql -uroot -p
>use mysql;
>update mysql.user set password=PASSWORD('123456') where User='root' ;
>flush privileges ;
or //在mysql 配置文件中加入以下一句话 ,重新启动输入 mysql 进入命令行修改密码 [root@test1 files]# vi /etc/my.cnf
[mysqld]
skip-grant-tables
[root@test1 files]# mysql
出错:
ERROR (HY000): You must SET PASSWORD before executing this statement
>SET PASSWORD = PASSWORD('');