MySQL 命令操作数据表
1.查看表信息
desc hs_user_credit_info;
2.新增表字段
alter table hs_credit_order add search_relation_names varchar(80) comment '尽调主体关联人-查询对象关联关系' ;
3.修改字段是否为null,修改描述:
alter table hs_user_credit_info modify credit_status int not null comment '状态:0风控审批结束 1有效 2作废 3过期';
4.修改字段名:
alter table student change physics physisc char(10) not null;
5.刷新表数据,但是不想更新修改时间
alter table hs_loan_order modify modify_time timestamp not null default CURRENT_TIMESTAMP;
-- update ....
alter table hs_loan_order modify modify_time timestamp not null default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间';
就是修改modify_time的默认值
本来的想法是直接去掉默认值
alter table hs_loan_order alter column modify_time drop default;
发现这样只能去除创建时更新时间更新,不能去除update时的刷新。
可以通过下面语句查看:
desc hs_loan_order;
也可以将更新语句写为:
update hs_capital_attachment_sync_info a,
(select max(order_by) order_by from hs_capital_attachment_sync_info) b
set a.order_by=b.order_by+1,a.modify_time=a.modify_time
where a.capital_order_id= #{capitalOrderId,jdbcType=VARCHAR} and a.file_type=#{fileType,jdbcType=INTEGER}
其中的不更新原有时间为:a.modify_time=a.modify_time
6.远程连接操作mysql
mysql -h18.16.200.6 -uroot -pshitou$root -P3306
如果有异常信息:
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2026 (HY000): SSL connection error: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
可以使用下面命令登录
mysql -h18.16.200.6 -uroot -pshitou$root -P3306 --ssl-mode=DISABLED
为了不被别人使用ps
命令查看到密码,可以使用下面的方式
直接使用别名
alias mysqllogin="mysql -hhostname -uusername -ppassword"
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)