centos 安装 MYSQL

1069天前 · 随笔 · 738次阅读

下载mysql 源

打开地址

https://dev.mysql.com/downloads/repo/yum/

找到 Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package

点击进去 找到 mysql 8.0 的源

在ssh 中下载

wget  https://repo.mysql.com//mysql80-community-release-el7-6.noarch.rpm

查找 并卸载 自带的mysql

rpm -qa|grep mysql
find / -name mysql

rpm -e --nodeps mysql-libs-5.1.*

安装mysql


//安装 mysql 源
yum localinstall mysql80-community-release-el7-3.noarch.rpm


//安装密钥
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

//安装mysql 8.0
yum install mysql-community-server


//启动 mysql
service mysqld start

修改mysql 密码

//查询密码
grep 'temporary password' /var/log/mysqld.log

//登录mysql
mysql -uroot -p 

//修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

//刷新权限
flush privileges;


//创建用户名
create user '你的用户名'@'%' identified with mysql_native_password by '你的密码';
create user 'gitea'@'%' identified with mysql_native_password by 'gitea147258;D';
//设置权限
grant all on *.* to '你的用户名'@'%';
grant all on *.* to 'gitea'@'%';
//刷新权限
flush privileges;
👍 0

none

最后修改于216天前

目录

avatar

星夜

19

文章数

1

评论数

4

分类