CentOS7.9安装mysql-8.0.28(最新)

一、下载

MySQL :: Download MySQL Yum Repositoryhttps://dev.mysql.com/downloads/repo/yum/下载安装源

二、将rpm包上传到服务器

省略

三、卸载mariadb

[root@XXXXX home]# rpm -qa | grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
[root@XXXXX home]# rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
[root@XXXXX home]# 

四、安装源

[root@iZuf63ffnpp8kxcttq0dghZ opt]# rpm -ivh mysql80-community-release-el7-5.noarch.rpm 
warning: mysql80-community-release-el7-5.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql80-community-release-el7-5  ################################# [100%]

五、安装mysql服务

yum install mysql-community-server

六、启动

[root@iZuf63ffnpp8kxcttq0dghZ opt]# systemctl start mysqld

七、登录数据库

# 查看初始密码
nano /var/log/mysqld.log

[root@iZuf63ffnpp8kxcttq0dghZ home]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.28

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

八、修改密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

# 碰到以上情况,将修改密码并修改密码强度

ALTER USER 'root'@'localhost' IDENTIFIED BY 'fhksjfs@HHH123';

# 密码修改成功后执行

set global validate_password.policy=low;
set global validate_password.length=6;

# 最后在执行就可以了
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

九、远程访问

use mysql

update user set user.Host='%' where user.User='root';

flush privileges;

systemctl restart mysqld

十、文件

配置文件  /etc/my.cnf
日志:/var/log/mysqld.log

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值