how to import a SQL file in MySQL command line
how to import a SQL file in MySQL command line
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-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13782010.html
未经授权禁止转载,违者必究!