Python论坛  - 讨论区

标题:[python-chinese] MySQLdb connect 问题

2008年01月02日 星期三 21:35

ZhangRuirui rrzhang在ipp.ac.cn
星期三 一月 2 21:35:24 HKT 2008

´ó¼ÒºÃ£¬
    ×î½üÒªÓõ½MySQLdbÕâ¸öÄ£¿é£¬°²×°µÄʱºòûÓб༭site.pyÕâ¸öÎļþ¡£°²×°ºÃÁËÒÔºó£¬import MySQLdbûÓб¨´í¡£µ«ÊÇ£º
help(MySQLdb)µÄʱºò³öÏÖÒÔÏ´íÎó£º
>>> help(MySQLdb)
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.3/site.py", line 308, in __call__
    return pydoc.help(*args, **kwds)
  File "/usr/lib/python2.3/pydoc.py", line 1545, in __call__
    self.help(request)
  File "/usr/lib/python2.3/pydoc.py", line 1581, in help
    else: doc(request, 'Help on %s:')
  File "/usr/lib/python2.3/pydoc.py", line 1372, in doc
    pager(title % desc + '\n\n' + text.document(object, name))
  File "/usr/lib/python2.3/pydoc.py", line 280, in document
    if inspect.ismodule(object): return self.docmodule(*args)
  File "/usr/lib/python2.3/pydoc.py", line 970, in docmodule
    for file in os.listdir(object.__path__[0]):
OSError: [Errno 20] Not a directory: '/usr/lib/python2.3/site-packages/MySQL_python-1.2.2-py2.3-linux-i686.egg/MySQLdb'

Ö´ÐÐÁ¬½ÓÃüÁîµÄʱºò ´íÎóÈçÏ£º
>>> db=MySQLdb.connect(db='pcs_east')
Traceback (most recent call last):
  File "", line 1, in ?
  File "build/bdist.linux-i686/egg/MySQLdb/__init__.py", line 74, in Connect
  File "build/bdist.linux-i686/egg/MySQLdb/connections.py", line 170, in __init__
_mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)")

ÓÃphpÓïÑÔ·ÃÎÊmysqlÊý¾Ý¿âûÓгöÏÖ"Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)´íÎó£¬ÇëÎÊÕâ¸öÊÇʲôԭÒò¡£
ÊÇÎÒ°²×°MySQLdbÓÐÎÊÌâÂð£¿

»¹ÓÐÒ»¸öÎÊÌ⣬°²×°µÚÈý·½Ä£¿éÊÇÓÃpython setup.py build£¬python setup.py install¡£Èç¹ûҪжÔØÒѾ­°²×°µÄÄ£¿é ÐèÒªÈçºÎ×ö£¿
лл´ó¼ÒÁË¡£


2008-01-02 



ZhangRuirui 
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080102/b0fbe246/attachment-0001.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2008年01月02日 星期三 21:52

Joey tang.jiyu在gmail.com
星期三 一月 2 21:52:57 HKT 2008

ºÃÏñûÓÐÅäÖÃsite.py£¬MySQLdb×°ÉϾÍÖ±½ÓºÃÓÃÁË¡£

²»¹ýÎÒÊÇÔÚwindowsÉÏʹÓõÄMySQLdb¡£

жÔØmoduleµÄ»°£¬¾ÍÖ±½ÓÔÚsite-packagesÏÂɾ³ý¶ÔÓ¦µÄÎļþ¾ÍºÃÁË°É


ÔÚ08-1-2£¬ZhangRuirui <rrzhang在ipp.ac.cn> дµÀ£º
>
>  ´ó¼ÒºÃ£¬
>     ×î½üÒªÓõ½MySQLdbÕâ¸öÄ£¿é£¬°²×°µÄʱºòûÓб༭site.pyÕâ¸öÎļþ¡£°²×°ºÃÁËÒÔºó£¬import MySQLdbûÓб¨´í¡£µ«ÊÇ£º
> help(MySQLdb)µÄʱºò³öÏÖÒÔÏ´íÎó£º
> >>> help(MySQLdb)
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "/usr/lib/python2.3/site.py", line 308, in __call__
>     return pydoc.help(*args, **kwds)
>   File "/usr/lib/python2.3/pydoc.py", line 1545, in __call__
>     self.help(request)
>   File "/usr/lib/python2.3/pydoc.py", line 1581, in help
>     else: doc(request, 'Help on %s:')
>   File "/usr/lib/python2.3/pydoc.py", line 1372, in doc
>     pager(title % desc + '\n\n' + text.document(object, name))
>   File "/usr/lib/python2.3/pydoc.py", line 280, in document
>     if inspect.ismodule(object): return self.docmodule(*args)
>   File "/usr/lib/python2.3/pydoc.py", line 970, in docmodule
>     for file in os.listdir(object.__path__[0]):
> OSError: [Errno 20] Not a directory:
> '/usr/lib/python2.3/site-packages/MySQL_python-1.2.2-py2.3-linux-i686.egg
> /MySQLdb'
>
> Ö´ÐÐÁ¬½ÓÃüÁîµÄʱºò ´íÎóÈçÏ£º
> >>> db=MySQLdb.connect(db='pcs_east')
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "build/bdist.linux-i686/egg/MySQLdb/__init__.py", line 74, in
> Connect
>   File "build/bdist.linux-i686/egg/MySQLdb/connections.py", line 170, in
> __init__
> _mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL
> server through socket '/var/lib/mysql/mysql.sock' (111)")
>
> ÓÃphpÓïÑÔ·ÃÎÊmysqlÊý¾Ý¿âûÓгöÏÖ"Can't connect to local MySQL server through socket
> '/var/lib/mysql/mysql.sock' (111)´íÎó£¬ÇëÎÊÕâ¸öÊÇʲôԭÒò¡£
> ÊÇÎÒ°²×°MySQLdbÓÐÎÊÌâÂð£¿
>
> »¹ÓÐÒ»¸öÎÊÌ⣬°²×°µÚÈý·½Ä£¿éÊÇÓÃpython setup.py build£¬python setup.py install¡£Èç¹ûҪжÔØÒѾ­°²×°µÄÄ£¿é
> ÐèÒªÈçºÎ×ö£¿
> лл´ó¼ÒÁË¡£
>
>
> 2008-01-02
> ------------------------------
> ZhangRuirui
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080102/d904e1a1/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2024

    京ICP备05028076号