CentOS 7 搭建mysql 5.7

young 768 2021-10-17
  1. 下载mysql源安装包

    
    wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
    
  2. 安装mysql源

    
    yum localinstall mysql57-community-release-el7-8.noarch.rpm
    
  3. 安装mysql

    
    yum -y install mysql-community-server
    
  4. 启动mysql服务

    
    systemctl start mysqld
    
  5. 查看mysql状态

    
    systemctl status mysqld
    
  6. 设置开机启动

    
    systemctl enable mysqld
    systemctl daemon-reload
    
  7. 修改root用户初试密码

    grep 'temporary password' /var/log/mysqld.log
    mysql -uroot -p
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'AAaa&000000';
    
  8. 添加远程访问

    
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'AAaa&000000' WITH GRANT OPTION;