美文网首页
centos7踩坑(三)安装MySQL5.7

centos7踩坑(三)安装MySQL5.7

作者: LiJinQuanan | 来源:发表于2019-02-15 16:44 被阅读0次

    安装MySQL5.7

    wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
    yum -y install mysql57-community-release-el7-10.noarch.rpm
    yum -y install mysql-community-server

    开启MySQL服务

    开启MySQL服务

    systemctl start mysqld

    查看MySQL状态

    systemctl status mysqld

    登陆MySQL

    查看原始密码

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

    登陆

    mysql -uroot -p

    修改新密码

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

    允许root远程连接(不推荐)

    use mysql;
    UPDATE user SET Host='%' WHERE User='root';
    flush privileges;

    设置允许远程连接的账号(推荐)

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

    修改默认编码格式

    vim /etc/my.cnf
    添加以下内容

    [mysqld]
    character-set-server=utf8
    [client]
    default-character-set=utf8
    [mysql]
    default-character-set=utf8
    

    重启MySQL
    systemctl restart mysqld
    查看编码格式

    mysql> show variables like 'character%';
    
    MySQL开启备份

    MySQL5.7 — mysqldump 备份与恢复

    相关文章

      网友评论

          本文标题:centos7踩坑(三)安装MySQL5.7

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