Linux安装MySQL5.7版本教程
MySQL是一种常用的关系型数据库管理系统,在Linux系统上进行安装是非常常见的任务。本文将为您提供一份简单的步骤指南,帮助您在Linux系统上成功安装MySQL,并提供一些实用技巧和建议。
镜像站
国内镜像:
https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/
centos7安装MySQL5.7
CentOS 8:安装光盘直接提供mysql-server:8.0以及mariadb-server : 10.3
CentOS 7:安装光盘直接提供mariadb-server:5.5 服务器包和mariadb 客户端工具包
所以centos7想要安装mysql必须采用其他方法,不然yum是直接安装不了的
1、rpm包安装
https://downloads.mysql.com/archives/community/
去下载相对版本的集合包
解压
tar xvf mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
按照顺序安装
yum install mysql-community-common-5.7.37-1.el7.x86_64.rpm
如果出现
file /usr/share/mysql/charsets/swe7.xml from install of mysql-community-common-5.7.37-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.68-1.el7.x86_64
不要慌,只是和mariadb冲突了把冲突的包卸载就行了 yum remove mariadb-libs-1:5.5.68-1.el7.x86_64
然后再安装上面那个mysql-community-commonyum install mysql-community-libs-5.7.37-1.el7.x86_64.rpm
yum install mysql-community-client-5.7.37-1.el7.x86_64.rpm
yum install mysql-community-server-5.7.37-1.el7.x86_64.rpm
启动
systemctl start mysqld
2、yum安装
[root@centos7 ~]#tee /etc/yum.repos.d/mysql.repo <<EOF
[mysql]
name=mysql5.7
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/
gpgcheck=0
EOF
安装
yum -y install mysql-community-server
启动mysql
systemctl start mysqld
rpm包安装后改密码
首先去日志找到初始化密码(mysql5.7包安装的特性)
登录后改密码mysql -uroot -p
然后输入密码alter user root@'localhost' identified by 'ycyawCOM996.';
如果提示Your password does not satisfy the current policy那么是你的密码强度不够,请加强密码结构
本文系作者 @亦秋先生 原创发布在亦秋先生博客站点。未经许可,禁止转载。
暂无评论数据