1. 标题通过 rpm -qa | grep mariadb 命令查看 mariadb 的安装包
rpm - qa | grep mariadb
2.通过 rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps 命令装卸 mariadb
rpm - e mariadb- libs- 5.5 .68 - 1 . el7. x86_64 -- nodeps
3.进入/usr/local目录,通过 mkdir mysql 命令 在当前目录下创建一个名为 mysql 的目录
cd / usr/ local
mkdir mysql
4.进入上传的包路径,通过 tar -xvf mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar 命令解压 tar 包
cd / usr/ local/ package
tar - xvf mysql- 8.0 .15 - 1 . el7. x86_64. rpm- bundle. tar
5.通过 rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm --nodeps --force 命令安装 common
rpm - ivh mysql- community- common- 8.0 .15 - 1 . el7. x86_64. rpm -- nodeps -- force
6.通过 rpm -ivh mysql-community-libs-8.0.15-1.el7.x86_64.rpm --nodeps --force 命令安装 libs
rpm - ivh mysql- community- libs- 8.0 .15 - 1 . el7. x86_64. rpm -- nodeps -- force
7.通过 rpm -ivh mysql-community-client-8.0.15-1.el7.x86_64.rpm --nodeps --force 命令安装 client
rpm - ivh mysql- community- client- 8.0 .15 - 1 . el7. x86_64. rpm -- nodeps -- force
8.通过 mysql-community-server-8.0.15-1.el7.x86_64.rpm --nodeps --force 命令安装 server
rpm - ivh mysql- community- server- 8.0 .15 - 1 . el7. x86_64. rpm -- nodeps -- force
9.通过以下命令,完成对 mysql 数据库的初始化和相关配置
8.0 以上mysql不区分大小写表配置
添加lower_case_table_names= 1
修改 / etc/ my. cnf
在[ mysqld] 增加
lower_case_table_names= 1
sudo mysqld -- defaults- file= / etc / my . cnf -- initialize -- user= mysql -- basedir= / var / lib/ mysql -- datadir= / var / lib/ mysql;
chown mysql: mysql / var / lib/ mysql - R ;
systemctl start mysqld. service;
systemctl enable mysqld;
10.通过 cat /var/log/mysqld.log | grep password 命令查看数据库的密码
cat / var / log/ mysqld. log | grep password
11.修改数据库密码及开启远程连接
SHOW VARIABLES LIKE 'validate_password%' ;
MySQL 8.0 调整密码验证规则:
set global validate_password. policy= 0 ;
set global validate_password. length= 1 ;
ALTER USER root@'localhost' IDENTIFIED WITH mysql_native_password BY '7758521Yzh' ;
use mysql;
update user set host= '%' where user = 'root' ;
flush privileges;
grant all privileges on * . * to 'root' @'%' with grant option;