CentOS6.5安装MySQL5.7
Posted dummyly
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS6.5安装MySQL5.7相关的知识,希望对你有一定的参考价值。
CentOS6.5安装mysql5.7
以hadoop用户登录系统,
1.检测系统是否已经安装过mysql或其依赖,若已装过要先将其删除,否则第4步使用yum安装时会报错:
#查看mysql是否安装,如果已经安装需要卸载,如果是
sudo rpm -qa|grep mysql
以hadoop用户登录系统,
1.检测系统是否已经安装过mysql或其依赖,若已装过要先将其删除,否则第4步使用yum安装时会报错:
#查看mysql是否安装,如果已经安装需要卸载,如果是
sudo rpm -qa|grep mysql
2、如果存在mysql,依次卸载
sudo yum -y remove mysql-community-server-5.7.23-1.el6.x86_64
sudo yum -y remove mysql-community-libs-5.7.23-1.el6.x86_64
sudo yum -y remove mysql-community-common-5.7.23-1.el6.x86_64
sudo yum -y remove mysql-community-client-5.7.23-1.el6.x86_64
find / -name mysql
sudo rm -rf /var/lib/mysql
sudo rm -rf /var/lib/mysql/mysql
sudo rm -rf /usr/share/mysql
sudo yum -y remove mysql-community-server-5.7.23-1.el6.x86_64
sudo yum -y remove mysql-community-libs-5.7.23-1.el6.x86_64
sudo yum -y remove mysql-community-common-5.7.23-1.el6.x86_64
sudo yum -y remove mysql-community-client-5.7.23-1.el6.x86_64
find / -name mysql
sudo rm -rf /var/lib/mysql
sudo rm -rf /var/lib/mysql/mysql
sudo rm -rf /usr/share/mysql
3、解压依次安装
tar -xvf mysql-5.7.23-1.el6.x86_64.rpm-bundle.tar
#解压
sudo rpm -ivh mysql-community-common-5.7.23-1.el6.x86_64.rpm
sudo rpm -ivh mysql-community-libs-5.7.23-1.el6.x86_64.rpm
sudo rpm -ivh mysql-community-client-5.7.23-1.el6.x86_64.rpm
sudo rpm -ivh mysql-community-server-5.7.23-1.el6.x86_64.rpm
4、启动服务
sudo service mysqld start #启动mysqld服务
sudo service mysqld start #启动mysqld服务
5、修改配置文件无密码登录
sudo vi /etc/my.cnf
在最尾部加上
skip-grant-tables
保存
6、重启mysql服务
sudo service mysqld restart
sudo vi /etc/my.cnf
在最尾部加上
skip-grant-tables
保存
6、重启mysql服务
sudo service mysqld restart
7、修改密码,mysql5.7用此语法
use mysql;
update mysql.user set authentication_string=password(‘1111‘) where user=‘root‘;
flush privileges;
8、回到第二步骤去掉加上的
skip-grant-tables
skip-grant-tables
9、以root用户登录
use mysql;
select ‘host‘ from user where user=‘root‘;
update user set host = ‘%‘ where user =‘root‘;
flush privileges;
use mysql;
select ‘host‘ from user where user=‘root‘;
update user set host = ‘%‘ where user =‘root‘;
flush privileges;
以上是关于CentOS6.5安装MySQL5.7的主要内容,如果未能解决你的问题,请参考以下文章
RedHat6.5/CentOS6.5安装Mysql5.7.20的教程详解
CentOS6.5安装MySQL5.7(也适合其他版本安装)