【问题标题】:using mysql-python only connects to my router, not my remote server使用 mysql-python 只连接到我的路由器,而不是我的远程服务器
【发布时间】:2013-03-04 21:58:11
【问题描述】:

使用带有模块的python:MySQLdb 我尝试连接到远程mysql服务器...

conn = mdb.connect('mysql.remotehost.com', 'username', 'password', 'database')

而不是尝试连接到 mysql.remotehost.com 我得到这个错误:

_mysql_exceptions.OperationalError: (1045, "Access denied for user 'username'@'xx.x.xxx.xxx' (using password: YES)")

其中 xx.x.xxx.xxx 是我的调制解调器/路由器的 IP 地址。为什么会这样?我怎样才能绕过它来实际访问我的远程 mysql 主机?

【问题讨论】:

  • 我也有同样的问题。我指定了正确的用户名和远程主机名,连接使用用户名但用本地机器的名称覆盖主机名。

标签: mysql-python


【解决方案1】:

您似乎无权从主机 xx.x.xxx.xxx 访问 MySQL。您需要授予用户访问权限。

【讨论】:

  • 但是 MySQL 数据库不在 xx.x.xxx.xxx 上,它在 mysql.remotehost.com 上,它确实有权授予用户访问权限。你是说用户实际上是完整的字符串'user@xx.x.xxx.xxx'?
猜你喜欢
  • 2014-12-11
  • 2017-08-01
  • 1970-01-01
  • 2010-12-28
  • 1970-01-01
  • 2011-05-08
  • 2015-07-31
  • 1970-01-01
相关资源
最近更新 更多