1.在线安装, 有时安装失败, 可能是自动选择镜像时问题
sudo yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
sudo yum install mysql-community-server mysql-community-client
启动mysql: sudo systemctl start mysqld
停止mysql: sudo systemctl stop mysqld
卸载:sudo yum remove mysql-community-server
2.使用下载的RPM包安装, 参考:https://blog.csdn.net/u013020593/article/details/134208847
到https://downloads.mysql.com/archives/community/下载5个RPM包, 分别是:
mysql-community-server-5.7.44-1.el7.x86_64.rpm
mysql-community-client-5.7.44-1.el7.x86_64.rpm
mysql-community-common-5.7.44-1.el7.x86_64.rpm
mysql-community-libs-5.7.44-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.44-1.el7.x86_64.rpm
5个包放到一个文件夹里面, 然后在文件夹里面安装, yum install mysql-community-*.rpm
如果之前使用在线安装失败, 有残留的包, 可以使用列表出已经安装的, yum list installed mysql*, 再卸载yum erase 包名
启动mysql: systemctl start mysqld
mysql -uroot -p
如果提示要密码, 需要修改密码, 可以在/etc/my.cnf里面加一行skip-grant-tables, 保存, 重启. 无密码进入, 修改root密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '1';
或
set password for root@localhost = password('1');
如果提示失败, 在skip-grant-tables模型下面不能修改, 可以刷新权限后再修改, 再刷新权限
flush privileges;
密码修改完成, 回到原my.cnf, 去掉skip-grant-tables, 保存, 重启, 再登录.
标签:centos,5.7,mysql5.7,community,yum,mysql,64,安装,el7 From: https://www.cnblogs.com/barrysgy/p/18216122