阿里云centos7从零开始搭建python环境,到使用flask+nginx+gunicorn部署。(三)mysql5.7下载以及远程连接

参考:

https://blog.csdn.net/weixin_38287709/article/details/80404648
https://blog.csdn.net/error395/article/details/79820499

1.创建一个文件夹:mkdir /usr/local/mysql

2.进入文件夹 cd /usr/local/mysql

2.1 下载RPM:wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

3.安装源:yum localinstall mysql57-community-release-el7-11.noarch.rpm

4.安装mysql:yum install mysql-community-server

5.启动服务:systemctl start mysqld

6.开机启动:systemctl enable mysqld; systemctl daemon-reload;

7.查看临时密码:grep ‘temporary password’ /var/log/mysqld.log;

8.输入密码:mysql -u root -p

9.修改密码:mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘新密码’;
注意:5.7版本密码至少要包含大小写字母,数字,特殊符号例如‘_’

远程连接:(慎用)

10.开启远程访问:mysql> GRANT ALL PRIVILEGES ON . TO ‘root’@’%'IDENTIFIED BY ‘自己设置一个密码’;

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

11.注意:阿里云的服务器不用管防火墙的,因为它默认是关闭的,起到防火墙作用的是安全组,因此,需要登录阿里云到控制台到安全组添加一条策略来开放3306端口。

你可能感兴趣的:(阿里云Centos7环境搭建)