阿里云服务器yum安装mysql

时间:2021-12-22 06:55:07

参考:https://dev.mysql.com/downloads/repo/yum/

  sudo wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm(下载rpm包)

  sudo rpm -Uvh mysql57-community-release-el7-11.noarch.rpm

  sudo yum install mysql-community-server(安装mysql)

  sudo systemctl start mysqld.service(启动mysql)

  sudo systemctl status mysqld.service(查看mysql状态)

  sudo grep 'temporary password' /var/log/mysqld.log(查看mysql最初的root密码用于登录)

  mysql -uroot -p(登录mysql)

  ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';(修改mysql的root密码为MyNewPass4!)