Is it possible to execute a database insert from t

2019-08-15 04:25发布

Normally if you wanted to execute a MySQL command you would just open up the MySQL command-line, but I'm trying to execute the command via Windows command-line.

It's possible that this is not possible, but I imagined the code looking something like this:

mysql -u root -pInsertPassword; USE InsertDatabaseName; INSERT INTO InsertDatabaseName (col1, col2) VALUES('data1', 'data2' ) 

Question, feedback, request -- just comment, thanks!!

System Setup:

  • MySQL: 5.1.53-community MySQL Community Server (GPL)
  • Window: 7

1条回答
何必那么认真
2楼-- · 2019-08-15 05:18

Windows supports pipes, so you can do:

echo insert into ... | mysql -uroot -p databaseName

查看更多
登录 后发表回答