how to import a SQL file in MySQL command line macOS
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