安装MySQL8.0.28 for linux(CentOS7)
2023-12-26 10:44:20
CentOS7安装MySQL8.0.28
一、下载MySQL安装包
点击以下链接可以自动跳转:MySQL官网
接下来按如图所示依次点击进入。
选择自己所需要版本
此处如需下载历史版本可以点击
二、安装配置mysql
如需下载ssh,请关注微信公众号:数据探索者007 回复 01获取下载链接以及详细安装步骤
1、登录ssh或其他相关软件上传mysql安装包
2、查看并解压刚刚上传的文件
解压命令如下:
tar -xvf mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar
3、查询是否有mariadb,如果有将其强制卸载掉
解压命令如下:
#查询命令
rpm -qa|grep mariadb
#强制卸载命令
rpm -e --nodeps maraidb-libs
卸载后检查是否卸载干净
4、依此安装所需mysql
依次执行如下指令(各包之有依赖关系,所以要依次执行)
rpm -ivh mysql-community-common-8.0.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.28-1.el7.x86_64.rpm
最后一步可能会出错如果出错可以在最后加 --force --nodeps如下:
rpm -ivh mysql-community-server-8.0.28-1.el7.x86_64.rpm --force --nodeps
具体步骤如下:
[root@localhost mysql]# ls
mysql-community-client-8.0.28-1.el7.x86_64.rpm mysql-community-icu-data-files-8.0.28-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.28-1.el7.x86_64.rpm mysql-community-libs-8.0.28-1.el7.x86_64.rpm
mysql-community-common-8.0.28-1.el7.x86_64.rpm mysql-community-libs-compat-8.0.28-1.el7.x86_64.rpm
mysql-community-devel-8.0.28-1.el7.x86_64.rpm mysql-community-server-8.0.28-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.28-1.el7.x86_64.rpm mysql-community-test-8.0.28-1.el7.x86_64.rpm
[root@localhost mysql]# rpm -ivh mysql-community-common-8.0.28-1.el7.x86_64.rpm
警告:mysql-community-common-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-common-8.0.28-1.e################################# [100%]
[root@localhost mysql]# rpm -ivh mysql-community-client-plugins-8.0.28-1.el7.x86_64.rpm
警告:mysql-community-client-plugins-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-client-plugins-8.################################# [100%]
[root@localhost mysql]# rpm -ivh mysql-community-libs-8.0.28-1.el7.x86_64.rpm
警告:mysql-community-libs-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-libs-8.0.28-1.el7################################# [100%]
[root@localhost mysql]# rpm -ivh mysql-community-client-8.0.28-1.el7.x86_64.rpm
警告:mysql-community-client-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-client-8.0.28-1.e################################# [100%]
[root@localhost mysql]# rpm -ivh mysql-community-icu-data-files-8.0.28-1.el7.x86_64.rpm
警告:mysql-community-icu-data-files-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-icu-data-files-8.################################# [100%]
[root@localhost mysql]# rpm -ivh mysql-community-server-8.0.28-1.el7.x86_64.rpm
警告:mysql-community-server-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
错误:依赖检测失败:
/usr/bin/perl 被 mysql-community-server-8.0.28-1.el7.x86_64 需要
net-tools 被 mysql-community-server-8.0.28-1.el7.x86_64 需要
perl(Getopt::Long) 被 mysql-community-server-8.0.28-1.el7.x86_64 需要
perl(strict) 被 mysql-community-server-8.0.28-1.el7.x86_64 需要
[root@localhost mysql]# rpm -ivh mysql-community-server-8.0.28-1.el7.x86_64.rpm --force --nodeps
警告:mysql-community-server-8.0.28-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-server-8.0.28-1.e################################# [100%]
[root@localhost mysql]#
5、初始化
mysqld --initialize --console
6、修改安装目录的所有者和所属组,以便让mysql软件用户有权限直接使用
chown -R mysql.mysql /var/lib/mysql/
7、启动mysql并修改密码
- 启动mysql : systemctl start mysqld
- 查看临时密码: cat /var/log/mysqld.log|grep localhost
- 登录mysql: mysql -uroot -p
- 输入临时密码
- 修改密码: alter user ‘root’@‘localhost’ identified by ‘root’;
- 退出重新登录: mysql -uroot -proot
此处所有步骤如下图所示
文章来源:https://blog.csdn.net/qq_46645079/article/details/135214111
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!