centos7.8---yum安装mysql5.7.36

Posted 小叶子i

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7.8---yum安装mysql5.7.36相关的知识,希望对你有一定的参考价值。

1.系统版本

[root@test001 ~]# cat /etc/redhat-release 
CentOS Linux release 7.8.2003 (Core)
[root@test001 ~]#

2.查看有无Mariadb的包,并卸载它

[root@test001 ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.65-1.el7.x86_64
[root@test001 ~]# rpm -e mariadb-libs-5.5.65-1.el7.x86_64 --nodeps

3.下载mysql rpm的官方yum源

[root@test001 ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
[root@test001 ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
[root@test001 ~]# yum -y install mysql-community-server

配置MySQL

[root@test001 ~]# systemctl start  mysqld.service
[root@test001 ~]# systemctl status mysqld.service
mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since 2021-12-05 16:29:12 CST; 30s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 3939 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 3881 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 3942 (mysqld)
Tasks: 27
CGroup: /system.slice/mysqld.service
└─3942 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

12 05 16:29:07 test001 systemd[1]: Starting MySQL Server...
12 05 16:29:12 test001 systemd[1]: Started MySQL Server.
[root@test001 ~]#




找出MySQL的密码:

[root@test001 ~]# grep "password" /var/log/mysqld.log
2021-12-05T08:29:10.359197Z 1 [Note] A temporary password is generated for root@localhost: *********
[root@test001 ~]#

centos7.8---yum安装mysql5.7.36_linux

此时不能做任何事情,因为MySQL默认必须修改密码之后才能操作数据库

其中‘new password’替换成你要设置的密码,注意:密码设置必须要大小写字母数字和特殊符号(,/;:等),不然不能配置成功

centos7.8---yum安装mysql5.7.36_html_02


开启mysql的远程访问 执行以下命令开启远程访问限制,我开启的是允许所有用户访问

centos7.8---yum安装mysql5.7.36_mysql_03

centos7.8---yum安装mysql5.7.36_.net_04


4.关闭防火墙

[root@test001 ~]# systemctl stop firewalld
[root@test001 ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@test001 ~]#


[root@test001 ~]# vi /etc/selinux/config


centos7.8---yum安装mysql5.7.36_linux_05


重启服务器。

[root@test001 ~]# systemctl start mysqld
[root@test001 ~]# systemctl status mysqld
mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since 2021-12-05 16:43:22 CST; 1min 54s left
Docs: man:mysqld(Linux第十周(二进制安装MYSQL5.7,编译安装MYSQL5.7,二进制安装mariadb10.4)

一分钟完成MySQL5.7安装部署

centos7安装mysql5.7步骤(图解版)

centos7安装mysql5.7步骤(图解版)

MySQL5.7.26安装

centos6.7下 编译安装MySQL5.7