how to import a SQL file in MySQL command line_MySQLhow to import a SQL file in MySQL command line macOS



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

how to import a SQL file in MySQL command line_macOS_02

OK

how to import a SQL file in MySQL command line_MySQL

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