CentOS系统安装配置mysql

一、mysql安装

安装mysql数据库:

yum install -y mysql mysql-server

判断mysql是否启动成功:

service mysqld start

二、mysql配置

1.登录mysql:

mysql -uroot -p

2.修改mysql.user里的host字段为%:

select host,user from mysql.user;

update mysql.user set host='%' where user='root' and host = '127.0.0.1';

3.刷新修改mysql:

flush privileges;

4.使用远程工具连接

在连接过程中如果出现连接不上的问题,可能是防火墙导致的,需要开放防火墙端口

添加需要监听的端口

/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

保存设置

/etc/init.d/iptables save

查看状态

/etc/init.d/iptables status

临时关闭防火墙服务

service iptables stop

开启防火墙服务

service iptables start

开机不再启动防火墙服务

chkconfig iptables off
原文地址:https://www.cnblogs.com/chenzheng8975/p/9370800.html