MySQL

mysqlでsqlを外部ファイルから実行する

More than 1 year has passed since last update.
mysql -u ユーザ -D スキーマ -pパスワード < sql_0904.txt

sql_0904.txtの中身

insert into test_table(test_clm, created)values('test1',CURRENT_TIMESTAMP);
insert into test_table(test_clm, created)values('test2',CURRENT_TIMESTAMP);
insert into test_table(test_clm, created)values('test3',CURRENT_TIMESTAMP);
insert into test_table(test_clm, created)values('test4',CURRENT_TIMESTAMP);
insert into test_table(test_clm, created)values('test5',CURRENT_TIMESTAMP);