2020.5.23 centos8 安装mysql 5.7
Posted liujunsblocg
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2020.5.23 centos8 安装mysql 5.7相关的知识,希望对你有一定的参考价值。
1.wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm --no-check-certificate 获取rpm 包
2. mv mysql-community-release-el6-5.noarch.rpm /home/liujun/ 将包移动到某个目录下
3.yum localinstall mysql-community-release-el6-5.noarch.rpm
4. yum repolist all | grep mysql 查看安装的依赖
5. /etc/yum.repos.d/mysql-community.repo 的设置如下,注意最后一栏 [mysql57-community-dmr]
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
# Enable to use MySQL 5.5
[mysql55-community]
name=MySQL 5.5 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
# Note: MySQL 5.7 is currently in development. For use at your own risk.
# Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
[mysql57-community-dmr]
name=MySQL 5.7 Community Server Development Milestone Release
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
6.sudo yum install mysql-server
修改密码:
在 /etc/my.cnf 后面加 skip-grant-tables 免密登录
1.systemctl restart mysqld 重启服务
2.mysql -u root -p 输入密码时直接按Enter键登录
3.update mysql.user set authentication_string=password(‘xxx‘) where user=‘root‘ and host=‘localhost‘; xxx 改为自己密码
4.flush privileges 刷新
5.skip-grant-tables
6.systemctl restart mysqld 再重启
命令:
1. rpm -qa | grep -i mysql 查询mysql 安装的依赖
2.yum install mysql-devel 安装后有mysql 文件夹
以上是关于2020.5.23 centos8 安装mysql 5.7的主要内容,如果未能解决你的问题,请参考以下文章
Centos8安装mysql5.7,修改mysql初始密码,使root可以访问远程主机. install mysql5.7 in Centos8, and change mysql initial p