一、SSH 连接
- 创建秘钥对
- 查看本地文件位置
- 命令行
命令行:
chmod 400 [.pem私钥文件在本地机上的存储路径]
ssh -i [.pem私钥文件在本地机上的存储路径] root@[公网IP地址]
示例:
chmod 400 ~/.ssh/ecs.pem
ssh -i ~/.ssh/ecs.pem root@10.10.xx.xxx
二、LNMP 部署
1. MySQL 修改密码 (5.6 版本)
- 停止mysql
systemctl stop mysqld.service
- 设置免密登录
vi /etc/my.cnf在mysqld下面加上
skip-grant-tables跳过输入密码阶段
- 启动mysql
systemctl start mysqld.service
- 进入mysql
mysql -u root -p (直接回车)
- 修改密码
5.7之前
update user set password=password(“密码”) where user=”root”;
5.7之后
update mysql.user set authentication_string=password(‘密码’) where user=’root’;
- 刷新设置
flush privileges;
- 退出,欢迎cnf设置,重启
exit;
vi /etc/my.cnf在mysqld下面删除skip-grant-tables
systemctl stop mysqld.service
systemctl start mysqld.service
- 登录
mysql -u root -p
输入密码