CentOS7 安装MySQL

作者: GCAmEmFG | 来源:发表于2020-04-04 20:45 被阅读0次

    下载:

    wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

    安装:

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

    yum install mysql-community-server

    开启服务

    systemctl start  mysqld.service

    获取临时密码:

    grep "password"  /var/log/mysqld.log

    设置密码:

    先用临时密码登陆

    mysql -uroot -p

    ->mysql  set global validate_password.policy=0;

    ->mysql  set global validate_password.length=1;

    再设置自己的密码

    ->mysql  alter user 'root'@'localhost' identified by '123456';

    开启远程访问:( mysql默认不允许远程登录,所以需要开启远程访问权限 )

    mysql -uroot -p

    ->mysql  use mysql;

    ->mysql  select user,authentication_string,host from user;

    ->mysql  update user set host = '%' where user = 'root';

    ->mysql  FLUSH PRIVILEGES;

    ->mysql  alter user 'root'@'%' identified with mysql_native_password by '123456';

    相关文章

      网友评论

        本文标题:CentOS7 安装MySQL

        本文链接:https://www.haomeiwen.com/subject/zresphtx.html