一:安装myql方式:
CentOS 7的yum源中貌似没有正常安装mysql时的mysql-sever文件,需要去官网上下载
二:安装完成之后远程mysql服务器遇到的问题解决方法
1:vi /etc/my.cnf文件我在本机上撞了一个centos7虚拟机,然后安装了社区版的mysql,开始老远程连接不到此mysql服务器
修改my.cnf使mysql监听在任意ip地址
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
2:
解决办法:安全模式修改root密码
#> service mysqld stop
#>mysqld_safe --skip-grant-tables &
输入 mysql -uroot -p 回车进入
>use mysql;
> update user set password=PASSWORD("123456")where user="root";
更改密码为 newpassord
> flush privileges; 更新权限
> quit 退出
service mysqld restart
mysql -uroot -p 新密码进入
3:放开3306端口防火墙在文件 vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
这是本人在虚拟机上安装mysql遇到的问题