关于spring:Linux7搭建MySQL8

37次阅读

共计 943 个字符,预计需要花费 3 分钟才能阅读完成。

一、筹备

查看 Linux 版本信息

uname -a

卸载 Linux7 自带的 mariadb

# 查看相干包
rpm -qa | grep mariadb

# 卸载相干包
rpm -e 查出来的包名,有依赖的一起删掉就行 

下载相干包

https://downloads.mysql.com/archives/community/

二、装置

写文章用的安装包

上传

将下载的包上传到服务器上

RPM 装置

程序曾经列出来了,不要错了

rpm -ivh  mysql-community-common-8.0.23-1.el7.x86_64.rpm
rpm -ivh  mysql-community-client-plugins-8.0.23-1.el7.x86_64.rpm
rpm -ivh  mysql-community-libs-8.0.23-1.el7.x86_64.rpm
rpm -ivh  mysql-community-client-8.0.23-1.el7.x86_64.rpm
rpm -ivh  mysql-community-server-8.0.23-1.el7.x86_64.rpm

查看

mysqladmin --version

三、启动

配置

默认的 dataDir 是对不上的。。须要批改下

vim /etc/my.cnf
datadir=/var/lib/mysql/mysql

启动

systemctl start mysqld
systemctl status mysqld

四、批改明码

查看默认明码

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

登录

mysql -u root -p

长期批改合乎规定的明码

alter user root@localhost identified by 'Root_123456';

更改明码策略

SHOW VARIABLES LIKE 'validate_password%';

set global validate_password.policy = low;
set global validate_password.length = 4; 
alter user root@localhost identified by '123456';
update user set host='%' where host='localhost';
systemctl restart mysqld; 

正文完
 0