1. 卸载MariaDB
先查看一下系统上的mariadb
#rpm -qa | grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
然后卸载
#rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
ps:
rpm -qa 列出所有已安装软件包
rpm -e packagename 删除软件包
rpm -e --nodeps packagename 强制删除软件和依赖包
rpm -q 包名 查询包是否安装
rpm -ivh 包名 安装软件包
2、下载mysql5.7.16 rpm安装包,官网最新的mysql安装包是mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar下载地址
# wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
然后解压
# tar -xvf mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
3、安装
依次执行(几个包有依赖关系,所以执行有先后)下面命令安装
[root@centos-linux ~]# rpm -ivh mysql-community-common-5.7.16-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-libs-5.7.16-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-client-5.7.16-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm
在安装rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm的时候报错如下:
[root@linux_node_1 src]# rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libaio.so.1()(64bit) is needed by mysql-community-server-5.7.16-1.el7.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.16-1.el7.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.16-1.el7.x86_64
net-tools is needed by mysql-community-server-5.7.16-1.el7.x86_64
这个报错的意思是需要安装libaio包和net-tools包:可以yum安装一下,安装 libaio-0.3.107-10.el6.x86_64.rpm,下载地址:wget http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm
然后yum安装net-tools yum install net-tools 完成之后就可以顺利安装
4.启动mysqlhist
#systemctl start mysqld.service
#mysql
[密码报错的]
设置mysql免密码登录
#vim /etc/my.cnf
在任意一行加入:skip-grant-tables i插入
退出,保存 Esc+:wq
重启mysqld#systemctl start mysqld.service
然后输入mysql进入客户端了
'''设置密码'''
use mysql ;
update mysql.user set authentication_string=password('123456') where user='root' ;
'''远程登录'''
update user set host = '%' where user ='root';
//SET PASSWORD = PASSWORD('YSY123456@ysy');//密码过于简单会报错
flush privileges;
网友评论