Linux安装Mysql

第一步:wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

第二步:yum localinstall mysql57-community-release-el7-8.noarch.rpm

第三步:yum repolist enabled | grep "mysql.-community."

第四步: yum install mysql-community-server

第五步:systemctl start mysqld

第六步:systemctl status mysqld

第七步:systemctl status mysqld.service

第八步:systemctl enable mysqld
第九步:systemctl daemon-reload

找到默认密码:grep 'temporary password' /var/log/mysqld.log

生成默认密码:fgqEQgPV3j*f

登录并修改密码:mysql -uroot -p
修改密码:ALTER USER 'root'@'localhost' IDENTIFIED BY 'Ysx251924!';
授权:GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'Ysx251924!' WITH GRANT OPTION;

开启防火墙端口权限:1 查看端口 firewall-cmd --list-ports
2 开发端口 firewall-cmd --zone=public --add-port=3306/tcp --permanent
3 重启 firewall-cmd --reload

你可能感兴趣的:(Linux安装Mysql)