3

How can I dump MySQL database table only which will store my on drive 'c:', rather than whole database

here is my running python connect script:

cnx = mysql.connector.connect(user='test',
                         password ='test',host='192.168.25.63',
                       database='test',port='3306')

I also refer to this question using subprocess: How to copy a database with mysqldump and mysql in Python?

I just want to have a python script just like having MySQLdump using windows command.

Community
  • 1
  • 1
Syntax Rommel
  • 932
  • 2
  • 16
  • 40

1 Answers1

0

You can simply use following command with popen:

import subprocess
subprocess.popen("mysqldump db_name table_name > your_path/table_name.sql", shell=True)
Mazdak
  • 105,000
  • 18
  • 159
  • 188