一、前置(删除已有mysql):
rpm -qa | grep mysql
rpm -e mysql57-community-release
二、安装
1、下载mysql包
wget http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
2、安装这个软件包
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
-i:安装软件包 -v:可视化,提供更多的详细信息的输出 -h:显示安装进度
3、编辑下面这个文件
vim /etc/yum.repos.d/mysql-community.repo
4、正式安装mysql
yum -y install mysql-community-server.x86_64
!!!如果报如下错误,则第4步后面接上–nogpgcheck 参数重新安装 !!
5、查看mysql服务状态和启动
systemctl status mysqld
systemctl start mysqld
6、查看Mysql临时密码
cat /var/log/mysqld.log | grep password
7、登录Mysql和修改密码,开启远程连接
mysql -u root -p
mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY 'Zxcvbnm123@';
mysql>update user set Host = '%' where Host = 'localhost' and User='root';
mysql>flush privileges;
|