How to import a SQL file in MySQL command line All In One
How to import a SQL file in MySQL command line All In One
execute
.sql
file, macOS
$mysql> source \home\user\Desktop\test.sql;
# file path === /Users/xgqfrms-mbp/Documents/GitHub/cms-koa-server/cms-koa/schema.sql
# 👍✅
$mysql> source /Users/xgqfrms-mbp/Documents/GitHub/cms-koa-server/cms-koa/schema.sql;
# 👎❌
# $mysql> source \Users\xgqfrms-mbp\Documents\GitHub\cms-koa-server\cms-koa\schema.sql;
Error
OK
command line & source
# MySQL command line
# file path === /Users/xgqfrms-mbp/Documents/GitHub/cms-koa-server/cms-koa/schema.sql
# 👍✅
$mysql> source /Users/xgqfrms-mbp/Documents/GitHub/cms-koa-server/cms-koa/schema.sql;
mysql Client Options
$ mysql -u username -p database_name < file.sql
https://dev.mysql.com/doc/refman/8.0/en/mysql-command-options.html
refs
©xgqfrms 2012-2025
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13782010.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
2019-10-08 OPS & cookie & HTTP Proxy
2019-10-08 React & componentWillReceiveProps & shouldComponentUpdate
2018-10-08 Unix/Linux/macOS & Node.js & NVM All In One
2018-10-08 PhantomJS & headless browser & pdf