阿里云Centos7安装mysql5.7
下载mysql安装包
wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
安装mysql
yum -y install mysql57-community-release-el7-11.noarch.rpm
yum install mysql-community-server
启动mysql服务
systemctl start mysqld.service
查看服务状态
systemctl status mysqld.service
查看初始密码
grep "password" /var/log/mysqld.log #复制密码
本地登录mysql
mysql -uroot -p
修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword'; #新密码含大写字母小写字母数字符号8位以上
授权
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'newpassword' WITH GRANT OPTION;
刷新
FLUSH PRIVILEGES;
退出mysql,自启动mysql服务
systemctl enable mysqld;
systemctl daemon-reload;
测试远程连接