当我尝试使用命令行在远程主机上执行mysqldump时,它将完美地运行
mysqldump -alv -h some_ip_here -Psome_port -usome_user some_db_name > /tmp/dumps/some_dump_file.sql
然而,当我使用os.command
在Python中尝试同样的事情时,我得到一个奇怪的访问被拒绝错误。
import os
command = 'mysqldump -alv -h some_host_ip -Psome_port -usome_user some_db_name > /tmp/dumps/some_dump_file.sql'
os.system(command)
这里有什么想法?
下面的Python实现的错误消息
-- Connecting to some_host_ip...
mysqldump: Got error: 1045: Access denied for user 'some_user'@'some_other_host_ip' (using password: YES) when trying to connect