下载
下载地址 : https://dev.mysql.com/downloads/mysql/
-- 下载地址 wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-client-plugins-8.0.25-1.el8.x86_64.rpm wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-common-8.0.25-1.el8.x86_64.rpm wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-libs-8.0.25-1.el8.x86_64.rpm wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-server-8.0.25-1.el8.x86_64.rpm wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-client-8.0.25-1.el8.x86_64.rpm
--安裝順序,根据情况适当调整
1) rpm -ivh mysql-community-common-8.0.25-1.el8.x86_64.rpm 2) rpm -ivh mysql-community-client-plugins-8.0.25-1.el8.x86_64.rpm 3) rpm -ivh mysql-community-client-8.0.25-1.el8.x86_64.rpm 4) rpm -ivh mysql-community-libs-8.0.25-1.el8.x86_64.rpm 5) rpm -ivh mysql-community-server-8.0.25-1.el8.x86_64.rpm
-- 启动数据库
service mysqld start
-- 查看数据库运行状态
service mysqld status
-- 停止数据库
service mysqld stop
-- 重启
service mysqld restart
用户密码重置
-- 打开mysql的配置文件 vim /ect/my.cnf -- 添加如下两行配置,启用免密登录 [mysqld] skip-grant-tables -- 重启M有SQL服务 service mysqld restart -- 重新登录MySQL mysql -uroot -p
-- 选择数据库
use mysql -- 将root账号密码置空,该语句为MySQL 8.0 update user set authentication_string = '' where user = 'root'; -- 设置新密码 alter user user() identified by 'root@123456';
修改加密方式
-- 登录 mysql -uroot -pRoot@123456 -- 选择数据库 use mysql -- 修改 ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Root@123456';