# 安装wget
yum -y install wget

# 下载安装源
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

# 安装源
yum -y localinstall mysql57-community-release-el7-11.noarch.rpm

# 安装
yum -y install mysql-community-server

# 启动
systemctl start mysqld

# 重启
systemctl restart mysqld

# 开机启动
systemctl enable mysqld
systemctl daemon-reload

# 修改登录密码
vi /var/log/mysqld.log
A temporary password is generated for root@localhost: ina:aBFr1Sp2

# 进入mysql
mysql -u root -p
    
    # 修改密码
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'Wtyicy@2019';

    # 设置允许远程登录
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Wtyicy@2019' WITH GRANT OPTION;
    
    # 设置编码(修改了记到重启)
    vi /etc/my.cnf
    [mysqld]下添加:
        character_set_server=utf8
        init_connect='SET NAMES utf8'
    
    # 查看编码
    show variables like '%character%';

    # 退出
    exit;

# 开启端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

    
    

 

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐