centos8.0 安装mysql8
1、查看当前linux版本
cat /etc/redhat-release
2、下载源
wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
3、安装软件包
//先解决旧版本的GPG keys造成的安装警告 rpm --import /etc/pki/rpm-gpg/RPM* //再安装 sudo rpm -Uvh mysql80-community-release-el8-1.noarch.rpm --force --nodeps
4、安装mysql
//查看mysql相关资源 yum repolist all | grep mysql //安装 yum install mysql-server
5、启动服务,查看状态
systemctl start mysqld.service systemctl status mysqld.service
6、设置开机启动
systemctl enable mysqld systemctl daemon-reload
7、默认密码为空,进入mysql
mysql -u root -p
8、修改密码命令
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
9、登录mysql
mysql -uroot -p use mysql; update user set host = '%' where user ='root'; select host, user from user;
10、刷新
flush privileges;