Centos7下使用rpm包安装mysql5.6数据库

Centos7下使用rpm包安装mysql5.6数据库

环境

[root@mysql01 ~]# uname -r
3.10.0-514.el7.x86_64
[root@mysql01 ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 

1.卸载MariaDB(CentOS7 默认自带)

rpm -qa | grep -i mariadb
mariadb-libs-5.5.52-1.el7.x86_64

rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64

-e 删除 --nodeps 强制删除

2.安装依赖

yum install m4 autoconf libaio

3.下载MySQL

下载MySQL:https://dev.mysql.com/downloads/mysql/
Centos7下使用rpm包安装mysql5.6数据库_第1张图片
打开后下面文字右键就可以获取下载地址。
No thanks, just start my download.

wget https://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.43-1.el7.x86_64.rpm-bundle.tar

4.安装MySQL

依照顺序安装.

tar -xvf MySQL-5.6.43-1.el7.x86_64.rpm-bundle.tar

rpm -ivh MySQL-client-5.6.43-1.el7.x86_64.rpm
rpm -ivh MySQL-devel-5.6.43-1.el7.x86_64.rpm
rpm -ivh MySQL-server-5.6.43-1.el7.x86_64.rpm

5.启动并配置mysql

systemctl start  mysql
#启动mysql
/sbin/chkconfig mysql on
#添加开机启动

cat /root/.mysql_secret
# (local time): qkVnNb7LzIinrYVp
#查看默认mysql密码

mysql -uroot -p'qkVnNb7LzIinrYVp'
#登录mysql

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
#修改为简单密码

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
#开启远程登录

测试

本地用Navicat连接远程mysql。 能链接上表明搭建成功。

你可能感兴趣的:(数据库)