centos 安装mysql 5.7

之前系统用的数据库一直是5.1 的,突然要更新成5.7 以为直接yum -y mysqld 就可以了,结果centos 默认安装的还是5.1
1.先建好存rpm包的文件夹

mkdir -p /usr/rmp
cd /usr/rmp 

2.下载官方的rpm 包

wget https://repo.mysql.com//mysql57-community-release-el6-11.noarch.rpm

3.添加yum源到存储库中

yum localinstall mysql57-community-release-el6-{version-number}.noarch.rpm

4.安装

yum install mysql-community-server

注意:到这一步,如果你在此之前试过yum 安装的话可能会出现一下这一对代码,这个是因为已经有一个yum 进程还在继续

Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  63 M RSS (508 MB VSZ)
    Started: Sun Jun 11 15:53:20 2017 - 00:21 ago
    State  : Traced/Stopped, pid: 3197
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  63 M RSS (508 MB VSZ)
    Started: Sun Jun 11 15:53:20 2017 - 00:23 ago
    State  : Traced/Stopped, pid: 3197

使用kill -s 9 3197 (3197进程pid)即可杀死进程
在执行一次即可安装
启动

service mysqld start
mysql -u root -p

5.设置密码
先关闭数据库服务

service mysqld stop
vim /etc/my.cnf 
添加 skip-grant-tables(跳过密码)
·········启动服务

关闭文件后 用mysql -u root直接登入 用以下命令操作密码

update mysql.user set authentication_string=password('至少8位') where User='root' and Host='localhost';

接着在重启一遍 用密码进行登入
如果有错误的地方请指出!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值