Learning mysql8 technology on oel7.9 platform

本文详细介绍了如何在 CentOS 7.9 操作系统上下载并安装 MySQL 8.0,包括解决依赖问题、启动 MySQL 服务以及重置 root 用户密码的步骤。在安装过程中遇到 mariadb-libs 的依赖冲突,并通过删除 mariadb-libs 解决了该问题。随后成功启动 MySQL 服务,并展示了如何创建新用户并赋予相应权限。
摘要由CSDN通过智能技术生成

Learning mysql8 technology on oel7.9 platform

1. mysql8 downloading and installation

  • download path for the latest release version: https://dev.mysql.com/downloads/mysql/
  • download path for the previous release version: https://downloads.mysql.com/archives/community/
  • download all packages 在这里插入图片描述
  • unpack the .tar package (tar zxvf mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar)
  • install .rpm packages in order
    rpm -i mysql-community-client-plugins-8.0.22-1.el7.x86_64.rpm
    rpm -i mysql-community-common-8.0.22-1.el7.x86_64.rpm
    rpm -i mysql-community-libs-8.0.22-1.el7.x86_64.rpm
    rpm -i mysql-community-client-8.0.22-1.el7.x86_64.rpm
    rpm -i mysql-community-server-8.0.22-1.el7.x86_64.rpm
  • check mysql version and make sure the installation was successful: mysql --version
[root@bogon Downloads]# mysql --version
mysql  Ver 8.0.22 for Linux on x86_64 (MySQL Community Server - GPL)

problem: when you install the mysql-community-libs-8.0.22-1.el7.x86_64.rpm package, if you have a problem like this

[root@bogon Downloads] rpm -i mysql-community-libs-8.0.22-1.el7.x86_64.rpm 
warning: mysql-community-libs-8.0.22-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
	mariadb-libs is obsoleted by mysql-community-libs-8.0.22-1.el7.x86_64

solution:

	[root@bogon Downloads] rpm -qa | grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
[root@bogon Downloads] rpm -e mariadb-libs-5.5.68-1.el7.x86_64
error: Failed dependencies:
	libmysqlclient.so.18()(64bit) is needed by (installed) net-snmp-agent-libs-1:5.7.2-49.el7.x86_64
	libmysqlclient.so.18()(64bit) is needed by (installed) net-snmp-1:5.7.2-49.el7.x86_64
	libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-9.el7.x86_64
	libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) net-snmp-agent-libs-1:5.7.2-49.el7.x86_64
	libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-9.el7.x86_64
	mysql-libs is needed by (installed) net-snmp-1:5.7.2-49.el7.x86_64
[root@bogon Downloads] rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64

2. Start the mysql service

 [root@bogon mysql] systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
[root@bogon mysql] systemctl start mysqld.service
[root@bogon mysql] systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-01-14 18:42:31 CST; 5s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 25591 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 25669 (mysqld)
   Status: "Server is operational"
    Tasks: 38
   CGroup: /system.slice/mysqld.service
           └─25669 /usr/sbin/mysqld
Jan 14 18:42:16 bogon systemd[1]: Starting MySQL Server...
Jan 14 18:42:31 bogon systemd[1]: Started MySQL Server.

3. Reset password for root user

  • check the temporary password: grep “password” /var/log/mysqld.log
  • mysqladmin -uroot -p’oldpassword’ password newpassword (This is an unsafe method)
  • log into MySQL using user ‘root’ and temporary password: mysql -uroot -p
  • reset password for user ‘root’ in three ways:
    SET PASSWORD FOR root@localhost = ‘Egtc!123456’;
    alter user ‘root’@‘localhost’ identified by ‘Egtc123$’;

4.Create new user

  • create user linda@localhost identified by ‘Linda123$’;
  • mysql> grant all privileges on student.* to linda@localhost;
  • mysql> flush privileges;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值