1、环境
CentOS-6.4
MysqL 5.7
2、下载MysqL http://dev.mysql.com/downloads/mysql/(个人认为centos6即下载el6版本,centos7下载el7版本)
MysqL-community-client-5.7.12-1.el6.i686.rpm
MysqL-community-common-5.7.12-1.el6.i686.rpm
MysqL-community-libs-5.7.12-1.el6.i686.rpm
MysqL-community-server-5.7.12-1.el6.i686.rpm
3、安装
# rpm -qa|grep MysqL
MysqL-libs-5.1.66-2.el6_3.i686
# rpm -e --nodeps MysqL-libs-5.1.66-2.el6_3.i686
3.2 使用rpm 命令安装(注意安装顺序)
安装MysqL
#rpm -hiv MysqL-community-common-5.7.12-1.el6.i686.rpm
#rpm -hiv MysqL-community-libs-5.7.12-1.el6.i686.rpm
#rpm -hiv MysqL-community-client-5.7.12-1.el6.i686.rpm
#rpm -hiv MysqL-community-server-5.7.12-1.el6.i686.rpm
4、启动MysqL
# service MysqLd start
5、MysqL5.7 开始有默认的密码
# cat /var/log/MysqLd.log|grep 'temporary password'
2016-06-21T20:44:15.278096Z 1 [Note] A temporary password is generated for root@localhost: =g0tde)VFWqE
初始密码为:=g0tde)VFWqE
6、登录
# MysqL -uroot -p
输入密码
登录后修改默认密码(MysqL密码有安全要求,要求有大小写特殊字符):
MysqL> SET PASSWORD = PASSWORD('Abc123!@#');
也可更改默认密码强度
set global validate_password_policy=0;
7、授权远程连接
MysqL>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Abc123!@#' WITH GRANT OPTION;
MysqL>FLUSH PRIVILEGES;
说明:如果远程连接不上,关闭防火墙。
8、设置自启动
# chkconfig --add MysqLd
# chkconfig --level 2345 MysqLd原文链接:https://www.f2er.com/centos/380772.html