1、注册腾讯云或者阿里云账号 实名认证
2、购买一个域名
3、购买一个服务器(我的是centos7)
学生优惠
购买服务器后,就会将服务器密码发给你,你就可以用xshell或者腾讯云网页提供的工具登录服务器。
4、将域名进行解析,解析到你的服务器上
填写你的服务器公网IP
即可。
5、下载xshell远程登录配置服务器,下载filezilla向服务器传送文件。
6、利用腾讯云提供文档搭建环境。
7、在服务器上(centos)安装mysql
请参考博客:https://www.cnblogs.com/ccplus/p/8686120.html
如果无法启动mysql,出现
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO)
解决:参考博文
这两篇博客中的重置密码在mysql8.0以上会不行,
要使用
alter user 'root'@'localhost'IDENTIFIED BY 'MyNewPass@123';
可能会出现
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
解决:参考博文
成功案例如下:
设置mysql可以远程连接;(参考博客)
1、改表法
use mysql;
update user set host = '%' where user = 'root';
2、授权法
mysql> use mysql;
Database changed
mysql> grant all privileges on *.* to root@'%' identified by "password";
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user,password from user;
+--------------+------+-------------------------------------------+
| host | user | password |
+--------------+------+-------------------------------------------+
| localhost | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
| 192.168.1.1 | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
| % | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
+--------------+------+-------------------------------------------+
3 rows in set (0.00 sec)
添加安全组:
8、远程连接数据库
使用Navicat连接,新建mysql连接
如果出现 ‘caching_sha2_password’ cannot be loaded的错误;
mysql8.0用户密码加密方式为caching_sha2_password,Navicat暂不支持,需要修改下mysql的加密方式:
登录mysql:
mysql -u root -p
查看当前加密方式:
use mysql;
select user,plugin from user where user='root';
修改加密方式:
alter user 'root'@'localhost' identified with mysql_native_password by 'password';
生效:
flush privileges;
参考博客:https://www.jianshu.com/p/939eb5157e83