【Mysql】CenterOs7 安装 Mysql

第一次安装mysql服务端。记录一下

  1. 查看当前Linux 版本,确认版本后,方便选择对应的mysql服务

    cat /etc/redhat-release
  2. 下载MySQL官方的 Yum Repository
    https://dev.mysql.com/downloa…
    《【Mysql】CenterOs7 安装 Mysql》
  3. 上传到linux上后 安装Repository
    《【Mysql】CenterOs7 安装 Mysql》
  4. 安装 Repository

     yum -y install mysql80-community-release-el7-3.noarch.rpm

    《【Mysql】CenterOs7 安装 Mysql》

  5. 成功后,安装 mysql server

       yum -y install mysql-community-server

    《【Mysql】CenterOs7 安装 Mysql》

  6. 启动 mysql 服务

    《【Mysql】CenterOs7 安装 Mysql》

  7. 更改mysql 用户密码
    登录mysql

     mysql -uroot -p

    修改密码

     mysql>  ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;

    修改用户运行远程登录

    mysql> use mysql;
    
    mysql> update user set host = '%' where user = 'root';
    
    mysql> select host, user from user;

    修改navicat链接mysql 的密码

     mysql>  ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';

    刷新

     mysql> FLUSH PRIVILEGES;
  8. 关闭防火墙

    查看防火墙状态

    firewall-cmd --state

    停止firewall

    systemctl stop firewalld.service

基本上就能用了。:)

    原文作者:kasaya
    原文地址: https://segmentfault.com/a/1190000019629943
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞