python 中的 MySQLdb 模块是否在安装时重新启动 MYSQL 服务?
Does the MySQLdb module in python restarts the MYSQL service on the instalation?
我需要在服务器上 运行 这个,但我想知道这是否会重新启动当前 MySQL 服务。
这是来自 pypi website
的 setup.py 代码
#!/usr/bin/env python
import os
import sys
import distutils.errors
import setuptools
if not hasattr(sys, "hexversion") or sys.hexversion < 0x02040000:
raise distutils.errors.DistutilsError("Python 2.4 or newer is required")
if os.name == "posix":
from setup_posix import get_config
else: # assume windows
from setup_windows import get_config
metadata, options = get_config()
metadata['ext_modules'] = [
setuptools.Extension(sources=['_mysql.c'], **options)]
metadata['long_description'] = metadata['long_description'].replace(r'\n', '')
setuptools.setup(**metadata)
所以那里没有任何东西会重新启动它。
我做了一个测试,用pip安装并没有重启mysqld服务。至少,它没有显示在 centos 6.7 的日志中。
此外,根据您的设置,停止服务需要 root 访问权限,但 pip 不需要。因此,为了确保服务在安装过程中不会停止,您可以使用没有 root 访问权限的用户并使用 pip 来安装模块,如下所示:
pip install MySQL-python
我需要在服务器上 运行 这个,但我想知道这是否会重新启动当前 MySQL 服务。
这是来自 pypi website
的 setup.py 代码#!/usr/bin/env python
import os
import sys
import distutils.errors
import setuptools
if not hasattr(sys, "hexversion") or sys.hexversion < 0x02040000:
raise distutils.errors.DistutilsError("Python 2.4 or newer is required")
if os.name == "posix":
from setup_posix import get_config
else: # assume windows
from setup_windows import get_config
metadata, options = get_config()
metadata['ext_modules'] = [
setuptools.Extension(sources=['_mysql.c'], **options)]
metadata['long_description'] = metadata['long_description'].replace(r'\n', '')
setuptools.setup(**metadata)
所以那里没有任何东西会重新启动它。 我做了一个测试,用pip安装并没有重启mysqld服务。至少,它没有显示在 centos 6.7 的日志中。
此外,根据您的设置,停止服务需要 root 访问权限,但 pip 不需要。因此,为了确保服务在安装过程中不会停止,您可以使用没有 root 访问权限的用户并使用 pip 来安装模块,如下所示:
pip install MySQL-python