Execute SQL file in Perl

前端 未结 4 423
一向
一向 2020-12-10 17:53

We have a Perl script which runs a SQL and puts data in the table. Now instead of supplying a single SQL statement, we want to pass bunch of them putting them together in a

4条回答
  •  Happy的楠姐
    2020-12-10 18:37

    You don't need perl for this at all. Just use the mysql command line client:

    mysql -h [hostname] -u[username] -p[password] [database name] < /home/user1/tools/mytest.sql

    replace the [variables] with your information.

    Note no space after -u or -p. If your mysql server is running on the same machine you can omit -h[hostname] (it defaults to localhost)

提交回复
热议问题