centos7 离线安装MySQL8.0.26 记录

本文详细记录了在Linux环境中卸载MariaDB并安装MySQL的完整过程,包括启动服务、查看初始密码、修改root密码、开启远程访问权限、创建新用户并授权,以及设置开机启动等步骤。最后展示了数据初始化和查询操作。
摘要由CSDN通过智能技术生成

删除原有mariadb

[root@test mysql]# rpm -qa | grep mariadb
mariadb-devel-5.5.52-1.axs7.x86_64
mariadb-libs-5.5.52-1.axs7.x86_64
[root@test mysql]# rpm -e --nodeps mariadb-libs-5.5.52-1.axs7.x86_64
[root@test mysql]# rpm -qa | grep mariadb                           
mariadb-devel-5.5.52-1.axs7.x86_64
[root@test mysql]# rpm -e --nodeps mariadb-devel-5.5.52-1.axs7.x86_6

安装rpm包

rpm -ivh mysql-community-client-plugins-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-common-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-embedded-compat-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-test-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-8.0.26-1.el7.x86_64.rpm

标题启动MySQL 查看初始密码

 systemctl start mysqld
 # 查看mysql 状态
 systemctl status mysqld

cat /var/log/mysqld.log | grep password
2021-08-02T02:53:22.066347Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Rk)fZFq%+7ru

修改默认密码

use mysql;
alter  USER   'root'@'localhost' identified with  mysql_native_password by 'DqyG89GwUjm1vR0oUqhH@';

开启远程登录

update user set host='%' where user = 'root';
flush privileges ;

创建子用户

use mysql;
CREATE USER  'pfpj'@'%' IDENTIFIED BY 'DqyG89GwUjm1vR0oUqhH@';
GRANT ALL ON *.* TO 'pfpj'@'%';
flush  privileges ;
-- 验证

开机启动

systemctl enable mysqld
#取消开机启动
 systemctl disable mysqld  
 netstat -ntlp | grep  mysql

数据初始化

use nmggzhhz;
source  /app/mysql/nmggzhhz.sql;
show tables ;

select * from t_bank_enterprise_balance ;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值