centos6.5安装MySQL5.7(使用yum源安装方法)

  1. 检测系统是否已安装 mysql
    [root@localhost ~]# yum list installed | grep mysql
  2. 删除系统已安装的 mysql 及其依赖
    [root@localhost ~]# yum -y remove mysql-libs.i686
  3. 给CentOS添加rpm源
    wget http://repo.mysql.com//mysql-community-release-el6-5.noarch.rpm
    4.安装yum源
    [root@localhost ~]# yum install mysql-community-release-el6-5.noarch.rpm
    [root@localhost ~]# yum repolist all | grep mysql
    [root@localhost ~]# yum repolist all | grep mysql
    [root@localhost ~]# yum-config-manager --disable mysql55-community
    [root@localhost ~]# yum-config-manager --disable mysql56-community
    [root@localhost ~]# yum-config-manager --enable mysql57-community-dmr
  4. 安装 MySQL 服务端
    [root@localhost ~]#yum install mysql-community-server
    Dependency Installed:
    mysql-community-client.x86_64 0:5.7.22-1.el6
    mysql-community-common.x86_64 0:5.7.22-1.el6
    mysql-community-libs.x86_64 0:5.7.22-1.el6

Complete!
看到以上结束语句,表示安装成功

  1. 启动 mysql 服务
    [root@localhost ~]# service mysqld start
    查看启动是否成功:
    [root@localhost ~]# service mysqld status
    mysqld (pid 10698) 正在运行...
  2. 修改 root 初始密码
    我这里用的是安全模式下进入设置密码
    [root@localhost ~]#service mysqld stop
    [root@localhost ~]#mysqld_safe –skip-grant-tables &
    重新开一个终端输入一下命令,然后直接敲enterj键:
    [root@localhost ~]#mysql -uroot -p
    进入之后,敲use mysql,用mysql数据库;
    修改root用户密码
    mysql> update user set authentication_string=password(123456) where user='root';
    注:mysql5.7的密码字段是authentication_string,不是password
    刷新权限并退出
    mysql> >flush privileges;
    mysql> >quit
    重启mysql,用密码123456即可登录mysql
    [root@localhost ~]# service mysqld restart
    [root@localhost ~]# mysql -u root -p
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
出现以上内容,登录成功

  1. 设置mysql开机启动
    [root@localhost ~]# chkconfig mysqld on
    [root@localhost ~]# chkconfig mysqld status

转载于:https://blog.51cto.com/10169618/2143042

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值