centos 7 下安装mysql5.7
centos下默认安装mariadb数据库
1:将mariadb移除
yum search mysql;
yum remove mariadb-libs.x86_64;
2:下载mysql源
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm;
3:安装源
yum localinstall mysql57-community-release-el7-11.noarch.rpm;
yum search mysql
4 安装mysql社区版
yum install mysql-community-server;
5:启动mysql
service mysqld start
6:查看mysql默认密码
cat /var/log/mysqld.log | grep password
7:设置mysql密码
SET PASSWORD = PASSWORD('');
8: 刷新权限
flush privileges;
9:设置mysql可远程连接
update `user` set Host = '%' where User = 'root' and Host = 'localhost';
设置后刷新权限
flush privileges;
10:查看mysql 是否启动
ps -ef |grep mysqld