【发布时间】:2012-01-24 12:16:28
【问题描述】:
当我在我的 virtualenv 中运行 mysqld 时,我收到一条错误并中止消息。
(nettuts)sez@sez-laptop:~/.virtualenvs$ mysqld
111220 15:22:59 [Warning] Can't create test file /var/lib/mysql/sez-laptop.lower-test
111220 15:22:59 [Warning] Can't create test file /var/lib/mysql/sez-laptop.lower-test
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
111220 15:22:59 [ERROR] Aborting
111220 15:22:59 [Note] mysqld: Shutdown complete
首先我尝试使用
安装 MySQL-pythonpip install -E default/ MySQL-python
这给了我
Requirement already satisfied (use --upgrade to upgrade): '
MySQL-python in ./default/lib/python2.7/site-packages
Cleaning up...
然后当我检查它是否已安装时,它显示它没有
(nettuts)sez@sez-laptop:~/.virtualenvs$ pip freeze
Django==1.3.1
wsgiref==0.1.2
然后我决定用pip install MySQL-python 安装它,它安装得很好,因为它显示了
(nettuts)sez@sez-laptop:~/.virtualenvs$ pip freeze
Django==1.3.1
MySQL-python==1.2.3
wsgiref==0.1.2
如何让MySQL-python 在 virtualenv 中正常运行?
更新
当我运行 sudo invoke-rc.d mysql start 这就是我得到的结果
(nettuts)sez@sez-laptop:~/.virtualenvs/nettuts$ sudo invoke-rc.d mysql start
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql start
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start mysql
然后当我按照指示运行start mysql 这就是我得到的
(nettuts)sez@sez-laptop:~/.virtualenvs/nettuts$ sudo start mysql
start: Job is already running: mysql
那么这里到底发生了什么?
【问题讨论】:
-
mysqld 已经在运行。您无需再次调用它。这就是正在发生的事情。
-
@FrancisAvila。是的,当我运行
ps aux | grep mysql时,我看到/usr/sbin/mysqld打印在第一行的末尾。
标签: python mysql virtualenv mysql-python virtualenvwrapper