Centos 7安装MySQL Community Server 5.5.60

时间:2022-09-13 17:06:36

1. 卸载MariaDB

rpm -qa | grep mariadb
rpm -e --nodeps mariadb-*

2.下载rpm包

Centos 7安装MySQL Community Server 5.5.60

yum install wget
MySQL-server-5.5.60-1.el7.x86_64.rpm
MySQL-client-5.5.60-1.el7.x86_64.rpm

3. 安装

rpm -ivh MySQL-server-5.5.60-1.el7.x86_64.rpm
rpm -ivh MySQL-client-5.5.60-1.el7.x86_64.rpm
# 批量安装
rpm -ivh MySQL-server-5.5.60-1.el7.x86_64.rpm MySQL-client-5.5.60-1.el7.x86_64.rpm
# 使用通配符
rpm -ivh *.rpm

# 安装依赖
yum install -y perl

4.配置文件

cp /usr/share/mysql/my-large.cnf /etc/my.cnf

5.启停服务

service mysql start service mysql stop

6.目录文件

/var/lib/mysql           数据文件
/usr/share/mysql         配置文件模板
/etc/my.cnf              默认配置文件

7.命令

show variables like '%dir%'; #查看数据文件位置
https://blog.csdn.net/fanshujuntuan/article/details/78077433

远程访问数据库

# 启停防火墙(客户端连接导致10060错误码)
systemctl stop firewalld.service 
systemctl stop firewalld.service 

# 账户设置
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;

# 修改生效
FLUSH PRIVILEGES;