centos安装mysql

1.查看是否已存在

yum list installed | grep mysql

2.卸载已安装的mysql

yum -y remove mysql-libs.x86_64

3.安装mysql

yum list | grep mysql 或 yum -y list mysql*  查看yum上的mysql

yum -y install mysql-server mysql mysql-devel  安装mysql

4.设置密码

set password for ‘root’@‘localhost’ = password('mypasswd');

5.登录

mysql -u root -p

6.开启3306端口

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

7.配置远程可以访问

update user set host = ‘%’ where user = ‘root’ and host=’127.0.0.1’;

8.更新权限

flush privileges;
原文地址:https://www.cnblogs.com/catchingdream/p/6809873.html