How do you run a single query through mysql from the command line?

前端 未结 5 1934
旧巷少年郎
旧巷少年郎 2021-01-30 08:02

I\'m looking to be able to run a single query on a remote server in a scripted task.

For example, intuitively, I would imagine it would go something like:



        
5条回答
  •  逝去的感伤
    2021-01-30 08:24

    If it's a query you run often, you can store it in a file. Then any time you want to run it:

    mysql < thefile
    

    (with all the login and database flags of course)

提交回复
热议问题