美文网首页
Centos7.2 安装Mysql 5.7

Centos7.2 安装Mysql 5.7

作者: pokerface_max | 来源:发表于2019-10-09 11:31 被阅读0次
    1. 下载安装源
    
    wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
    
    
    1. 安装rpm
    
    yum localinstall mysql57-community-release-el7-8.noarch.rpm
    
    
    1. 查看rpm源是否安装成功
    
    yum repolist enabled | grep "mysql.*-community.*"
    
    

    4.安装

    
    yum install mysql-community-server
    
    
    1. 启动
    
    systemctl start mysqld
    
    systemctl status mysqld
    
    systemctl enable mysqld
    
    systemctl daemon-reload
    
    
    1. 查看修改密码

    默认密码在/var/log/mysqld.log文件中

    取得默认密码,最好复制

    
    grep 'temporary password' /var/log/mysqld.log
    
    
    1. 修改密码
    
    mysql -u root -p   
    
    

    输入刚复制的密码

    
    set password for 'root'@'localhost'=password('新密码');
    
    
    1. 查看和修改数据库的默认字符集
    
    show variables like '%character%';
    
    set character_set_database = utf8mb4;
    
    

    9.创建数据库

    
    create database $DATABASENAME;
    
    

    9.创建用户

    
    create user "username"@"host" identified by "password";
    
    
    1. 授权
    
    grant all privileges on $DBNAME.* to $USER@'%' identified by '$PASSWORD';
    
    flush privileges;
    
    

    相关文章

      网友评论

          本文标题:Centos7.2 安装Mysql 5.7

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