服务器操作笔记

ssh 远程连接服务器

ssh -p22 user@49.233.186.242 #用户名@公网地址
passwd :

上传文件

scp /path/filename username@servername:/path ;# 直接使用没有权限

暴露服务器端口是外部可以访问

连接服务器上的数据库

用ping 测试服务器的网络是否正常

运行代码时候查看服务器的报错

进入tomcat/logs/文件夹下 tail -f catalina.out
http://49.233.186.242/spring/main

在服务器端授权数据库可以远程连接

# 进入mysql数据库
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
## springboot 连接远程服务器的数据库
#端口号配置
server:
port: 8080
spring:
#模板引擎配置
thymeleaf:
prefix: classpath:/templates/
suffix: .html
mode: HTML
encoding: UTF-8
cache: false
servlet:
content-type: text/html
#静态文件配置
resources:
static-locations: classpath:/static/,classpath:/META-INF/resources,classpath:/templates/
#jdbc配置jdbc:mysql://localhost:3306
datasource:
url: jdbc:mysql://49.233.186.242:3389/db1?useUnicode=true&characterEncoding=utf8&useSSL=false
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
#mybatis配置
mybatis:
#映射文件路径
mapper-locations: classpath:mapper/*.xml,classpath:generator/*.xml
#模型所在的保命
type-aliases-package: com.yt.springtest.model

posted @   牵我狗  阅读(147)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示