简体   繁体   English

MySQLdb未知的MySQL服务器主机

[英]MySQLdb Unknown MySQL server host

I have python 2.7 installed. 我安装了python 2.7。 I have wamp running. 我正在跑步。 I have MySQL running on 10127 port. 我的MySQL在10127端口上运行。 I have root set up with no password i have (unrelated) php code running that connects fine with the call mysql_connect('localhost:10127', 'root', ''); 我已经设置了没有密码的root用户,我运行了(不相关的)php代码,该代码与调用mysql_connect('localhost:10127','root','')正常连接。

when i try from the command line: 当我从命令行尝试时:

mysql -u 'root' -p '' -h 'localhost:10127'

i get the error 我得到错误

Unknown MySQL server host 'localhost:10127' 未知的MySQL服务器主机'localhost:10127'

Similarly, when i make the call 同样,当我打电话时

   import MySQLdb as mdb
    import sys
    con = mdb.connect('localhost:10127', 'root','', 'dbname')

i get the error 我得到错误

Unknown MySQL server host 'localhost:10127' (11004)" 未知的MySQL服务器主机'localhost:10127'(11004)”

Does anyone know why-oh-why? 有谁知道为什么-哦-为什么?

CLI期望:

mysql -u root -h localhost --port 10127

mysql -u 'root' -p '' -h localhost -p 10127 mysql -u'root'-p''-h本地主机-p 10127

https://dev.mysql.com/doc/refman/5.5/en/mysql-command-options.html https://dev.mysql.com/doc/refman/5.5/en/mysql-command-options.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM