import subprocess
import sys
sys.path.append('/usr/local/mysql-5.7.29-macos10.14-x86_64/bin')
print(sys.path)
command_exp = '/usr/local/mysql-5.7.29-macos10.14-x86_64/bin/mysqldump -h127.0.0.1 -uroot -pwyf880701 --add-drop-table --skip-lock-tables synctool tl_log> synctool_test.sql'
exit_code = subprocess.call(command_exp, shell=True)
print(exit_code)
command_imp = '/usr/local/mysql-5.7.29-macos10.14-x86_64/bin/mysql -h127.0.0.1 -uroot -pwyf880701 test < synctool_test.sql'
exit_code = subprocess.call(command_imp, shell=True)
print(exit_code)
Python3调用MySQL指令对数据库进行导入导出
最新推荐文章于 2023-12-19 10:54:59 发布