Advertisement

centos7离线安装mysql5.7

阅读量:

1、下载安装包

复制代码
    wget https://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar

2、解压

复制代码
    tar -xf mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar

3、安装

复制代码
    sudo yum install mysql-community-{server,client,common,libs}-*

4、启动mysql服务

复制代码
    sudo service mysqld start

5、获取临时密码

复制代码
    sudo grep 'temporary password' /var/log/mysqld.log

6、使用临时密码登录

复制代码
    mysql -uroot -p
    输入临时密码

7、设置密码

复制代码
    set global validate_password_policy=0;
    set global validate_password_length=1;
    ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

8、修改远程访问权限,不然用工具连接不上

复制代码
    grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
    flush privileges;

9、设置字符集

复制代码
    vim /etc/my.cnf
    #在[mysqld]部分添加:
    character-set-server=utf8
    #在文件末尾新增[client]段,并在[client]段添加:
    default-character-set=utf8

全部评论 (0)

还没有任何评论哟~