centos yum安装mysql
1、官网下载
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
2、yum安装
yum -y install mysql57-community-release-el7-10.noarch.rpm
3、安装mysql
yum -y install mysql-community-server
4、启动mysql
systemctl start mysqld.service
5、查看初始密码
grep "password" /var/log/mysqld.log
6、登录mysql
mysql -uroot -p # 回车后会提示输入密码
7、修改初始密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
flush privileges;