What I\'d like to achieve is the launch of the following shell command:
mysql -h hostAddress -u userName -p userPassword databaseName < fileName
You have to feed the file into mysql stdin by yourself. This should do it.
import subprocess ... filename = ... cmd = ["mysql", "-h", ip, "-u", mysqlUser, dbName] f = open(filename) subprocess.call(cmd, stdin=f)