Centos 7安装MySQL Community Server 5.5.61

1. 卸载MariaDB

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

2.下载rpm包

yum install wget
wget https://cdn.mysql.com//Downloads/MySQL-5.5/MySQL-5.5.61-2.el7.x86_64.rpm-bundle.tar
tar -vxf MySQL-5.5.61-2.el7.x86_64.rpm-bundle.tar

3. 安装

yum install -y perl
yum install -y perl-DBI
rpm -ivh mysql-community-common-5.5.61-2.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.5.61-2.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.5.61-2.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.5.61-2.el7.x86_64.rpm

4.启停服务

service mysqld status
service mysqld start
service mysqld stop

5.数据文件目录与配置文件

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

6.命令

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;

你可能感兴趣的:(MySQL)