yum install http://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm
yum repolist all | grep mysql
yum install mysql-community-server
service mysqld start
搜索默认初始密码
grep 'temporary password' /var/log/mysqld.log
2016-11-26T16:01:37.738626Z 1 [Note] A temporary password is generated for root@localhost: M4ym/:3h72mx
[root@bogon ~]# mysql -uroot -pM4ym/:3h72mx
用默认密码登录
mysql -uroot -pM4ym/:3h72mx
登录后修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
赋权远程登录
use mysql;
update user set host = '%' where user ='root';
ip设置: eth0里设置为dhcp, 不要复制eh0为eth1去改,否则要修改/etc/udev/rules.d/70-persistent-net.rules。(较新的稳定版本如centos7.2不需要修改)
BOOTPROTO=dhcp 启动网络还不生效则重启虚机
另外一台机器登录,报10060,根据【1】
开放3306端口
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT;
/etc/init.d/iptables save;
重启防火墙:
service iptables stop;
service iptables start;
再次登录,ok
参考文档 :
1.http://www.zhimengzhe.com/shujuku/MySQL/49454.html mysql连接报10060错误排查