环境:
redhat6.5
MySQL Community Server 5.7.28 https://dev.mysql.com/downloads/mysql/5.7.html
前提环境:关闭selinux
安装RMP包的具体操作如下:
1、如有mariadb,先卸载
rpm -qa |grep mariadb
rpm -qa |grep mysql
rpm -e --nodeps xxxxxx (卸载查询到的rpm包)
2、安装新的mysql5.7.28,解压安装包
tar -xvf mysql-5.7.28-1.el6.x86_64.rpm-bundle.tar
3、rpm安装(不是所有包必须安装,但必须按顺序安装)
rpm -ivh mysql-community-common-5.7.28-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.28-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.28-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.28-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.28-1.el6.x86_64.rpm # 注:linux 7版本会有报错 命令后加上参数[--nodeps --force]
rpm -ivh mysql-community-devel-5.7.28-1.el6.x86_64.rpm
4、安装完毕,数据库初始化
mysqld --initialize --user=mysql
5、查看临时生成的数据库密码
cat /var/log/mysqld.log
6、启动mysql
service mysqld start
7、登陆mysql数据库,并修改密码
mysql -uroot -p
set password = password('password');
至此安装完毕!
利用Navicat工具连接mysql(root用户)
mysql -uroot -p 进入数据库
use mysql
select host,user from user;
update user set host='%' where user='root';
GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
flush privileges;