我有一个简单的问题
当我通过python将数据放入本地主机服务器的数据库时,我执行以下操作
db= MySQLdb.connect("localhost", "root", "pass", "Database")
现在我有一个主机服务器,我和我的朋友共享
Cpanel数据库部分的快照如附件所示。在
现在我应该在下面的代码中输入什么来连接数据库
^{pr2}$我试过了,但失败了]
db= MySQLdb.connect("moeenmh.com","moeenmh_ahmed","<mypass>","moeenmh_ahmed")
我为自己创建的用户是moeenmh_ahmed,并且有密码]
错误是"Access denied for user 'moeenmh_ahmed'@'91.74.98.6' (using password: YES)")
数据库名称必须是全名,而不仅仅是
_ahmed
部分。所以它应该是moeemnh_adhmed
。对于远程连接,协议应为“TCP”。在另外,检查您是否为远程连接配置了MySQL。因此,首先尝试使用:
mysql -u moeenmh_ahmed -h moeenmh.com -p
请看下面这个设置特权的答案:https://stackoverflow.com/a/12844804/1431750。引用:
从Cpanel屏幕截图中我可以看到moeenmh_ahmed没有访问moeenmh_ahmed DB的权限。 您可以在Cpanel文档中看到如何执行此操作: http://docs.cpanel.net/twiki/bin/view/AllDocumentation/CpanelDocs/MySQLDatabases#Define用户的权限
相关问题 更多 >
编程相关推荐