原文:https://blog.csdn.net/pengjunlee/article/details/81212250
1、卸载mariadb
1)查看mariadb
[root@localhost ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.52-1.el7.x86_64
2)卸载
rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64
2、下载并安装mysql
1)下载安装包
进入并创建安装目录 mkdir /var/mysql
*下载安装包
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
*安装mysql
rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装完成之后,会在 /etc/yum.repos.d/ 目录下新增 mysql-community.repo 、mysql-community-source.repo 两个 yum 源文件
yum install mysql-server
检查mysql是否安装成功
rpm -qa | grep mysql
*启动/停止/重启mysql
systemctl start/stop/restart mysqld
设置开机自启动
systemctl enable mysqld
2)配置
复制配置文件到/etc/my.cnf中
cp /support-files/my-default.cnf /etc/my.cnf
设置表名不区分大小写
在[mysql]节点下添加 lower_case_table_names=1,再重启mysql ,systemctl restart mysqld
3)添加远程用户
grant all privileges on *.* to admin@"%" identified by 'something' with grant option;
添加了一个账号admin,密码something的远程用户
执行 flush privileges;