centOS 7安装mysql

1、删除原来的mysql

yum remove mariadb-libs.x86_64

2、创建文件目录

mkdir /etc/mysql

3、进入到/etc/mysql,然后

wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

https://dev.mysql.com/downloads/file/?id=509665
下载安装包
可使用为get【复制网址】 下载

wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

添加到本地

yum localinstall 【文件】

centOS 7安装mysql_第1张图片

4、安装

yum install mysql-community-server

如果失败报错
The GPG keys listed for the “MySQL 5.7 Community Server” repository are already installed but they a …
执行

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

5、 启动测试

 service mysqld start 

查看启动状态

service mysqld status

查看密码

cat /var/log/mysqld.log | grep password

密码登录

mysql -u root -p 

你可能感兴趣的:(后端)