1、查看是否有其他版本MySQL
1.1 查看有没有MySQL
rpm -qa |grep -i mysql
1.2 卸载
yum remove mysql-community mysql-community-server mysql-community-libs mysql-community-common
卸载页面:
1.3查看是否卸载干净
rpm -qa |grep -i mysql
继续卸载:
yum remove mysql80-community-release-el7-3.noarch
1.4再检查是否卸载完成
rpm -qa |grep -i mysql
rm -rf /usr/share/mysql-8.0
另一种方式:
2.安装8.0
2.1搜索mysql版本
docker search mysql
2.2 下载
docker pull mysql(不写版本号默认最新版)
2.3 创建文件
命令:cd /opt/
命令:mkdir mysql_docker
命令:cd mysql_docker/
命令:echo $PWD
2.4创建实例
docker run -p 3306:3306 --name mysqlserver -e MYSQL_ROOT_PASSWORD=Root123 -d mysql
//mysqlserver 实例名字
2.5 查看容器
cd /var/lib/docker/containers/
3.远程登录修改
docker exec -it mysql8.0 bash
select now();
use mysql;
select host,user from user;
ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘Root123’;
flush privileges;