centos 安装MySQL5.7

1、配置yum源mysql

   一、下载yum源 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpmsql

    二、安装 yum localinstall mysql57-community-release-el7-8.noarch.rpmthis

    三、检查是否安装成功 yum repolist enabled | grep "mysql.*-community.*" server

 2、安装MySQLget

    一、安装 yum install mysql-community-serverit

    二、启动MySQL服务 systemctl start mysqld登录

    三、查看是否启动成功 systemctl status mysqld配置

3、MySQL相关设置date

    一、默认密码再也不是空,安装时会随机在/var/log/mysqld.log文件生成一个密码,查看临时密码:下载

    grep 'temporary password' /var/log/mysqld.log,

    二、登陆后修改密码:set password for 'root'@'localhost'=password('MyNewPass4!');(注意:密码必须包含大小写字母、数字和特殊符号,而且长度不能少于8位)

    3 、设置远程链接(不是会报Host ‘XXX’ is not allowed to connect to this MySQL server错误)

    mysql>use mysql;

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

   mysql>GRANT ALL PRIVILEGES ON *.* TO '(用户名)'@'%' IDENTIFIED BY '(密码)' WITH GRANT OPTION;

    mysql>flush privileges;

相关文章
相关标签/搜索