////// 问题描述:安装 MySQL-python 出错
////// 解决思路: 用yum重装mysql,再试试
////// 难点: 重装MySQL,并且改变数据文件夹的位置,还会涉及到socket,进而影响php连MySQL
///
/// install MySQL-python-1.2.5
///
[root@wode004 MySQL-python-1.2.5]# python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -m64 -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing
_mysql.c:44:23: 致命错误:my_config.h:没有那个文件或目录
#include "my_config.h"
^
编译中断。
error: command 'gcc' failed with exit status 1
[root@wode004 MySQL-python-1.2.5]#
///
/// yum install mysql-devel
///
Transaction check error:
file /usr/bin/mysql_config-64 from install of mysql-community-devel-5.6.27-2.el7.x86_64 conflicts with file from package mysql-community-client-5.6.26-2.el7.x86_64
///
/// yum remove mysql-libs
///
================================================================================
正在删除:
mysql-community-libs x86_64 5.6.26-2.el7 @mysql56-community 9.2 M
mysql-community-libs x86_64 5.6.27-2.el7 installed 9.2 M
为依赖而移除:
mysql-community-client x86_64 5.6.26-2.el7 @mysql56-community 88 M
mysql-community-client x86_64 5.6.27-2.el7 installed 88 M
mysql-community-server x86_64 5.6.27-2.el7 @mysql56-community 245 M
perl-DBD-MySQL x86_64 4.023-5.el7 @anaconda 323 k
postfix x86_64 2:2.10.1-6.el7 @anaconda 12 M
qt-mysql x86_64 1:4.8.5-8.el7 @anaconda 74 k
redhat-lsb x86_64 4.1-27.el7.centos.1 @base 0.0
redhat-lsb-core x86_64 4.1-27.el7.centos.1 @base 45 k
redhat-lsb-cxx x86_64 4.1-27.el7.centos.1 @base 0.0
redhat-lsb-desktop x86_64 4.1-27.el7.centos.1 @base 0.0
redhat-lsb-languages x86_64 4.1-27.el7.centos.1 @base 814
redhat-lsb-printing x86_64 4.1-27.el7.centos.1 @base 0.0
事务概要
================================================================================
移除 2 软件包 (+12 依赖软件包)
安装大小:451 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在删除 : redhat-lsb-4.1-27.el7.centos.1.x86_64 1/14
正在删除 : redhat-lsb-cxx-4.1-27.el7.centos.1.x86_64 2/14
正在删除 : redhat-lsb-desktop-4.1-27.el7.centos.1.x86_64 3/14
正在删除 : redhat-lsb-languages-4.1-27.el7.centos.1.x86_64 4/14
正在删除 : redhat-lsb-printing-4.1-27.el7.centos.1.x86_64 5/14
正在删除 : redhat-lsb-core-4.1-27.el7.centos.1.x86_64 6/14
正在删除 : 2:postfix-2.10.1-6.el7.x86_64 7/14
正在删除 : perl-DBD-MySQL-4.023-5.el7.x86_64 8/14
正在删除 : mysql-community-server-5.6.27-2.el7.x86_64 9/14
警告:文件 /var/lib/mysql: 移除失败: 没有那个文件或目录
警告:/etc/my.cnf 已另存为 /etc/my.cnf.rpmsave
正在删除 : mysql-community-client.x86_64 10/14
正在删除 : 1:qt-mysql-4.8.5-8.el7.x86_64 11/14
正在删除 : mysql-community-client.x86_64 12/14
正在删除 : mysql-community-libs.x86_64 13/14
正在删除 : mysql-community-libs.x86_64 14/14
验证中 : mysql-community-client-5.6.26-2.el7.x86_64 1/14
验证中 : 1:qt-mysql-4.8.5-8.el7.x86_64 2/14
验证中 : mysql-community-libs-5.6.26-2.el7.x86_64 3/14
验证中 : redhat-lsb-core-4.1-27.el7.centos.1.x86_64 4/14
验证中 : redhat-lsb-desktop-4.1-27.el7.centos.1.x86_64 5/14
验证中 : redhat-lsb-4.1-27.el7.centos.1.x86_64 6/14
验证中 : mysql-community-server-5.6.27-2.el7.x86_64 7/14
验证中 : redhat-lsb-languages-4.1-27.el7.centos.1.x86_64 8/14
验证中 : mysql-community-client-5.6.27-2.el7.x86_64 9/14
验证中 : 2:postfix-2.10.1-6.el7.x86_64 10/14
验证中 : mysql-community-libs-5.6.27-2.el7.x86_64 11/14
验证中 : perl-DBD-MySQL-4.023-5.el7.x86_64 12/14
验证中 : redhat-lsb-printing-4.1-27.el7.centos.1.x86_64 13/14
验证中 : redhat-lsb-cxx-4.1-27.el7.centos.1.x86_64 14/14
删除:
mysql-community-libs.x86_64 0:5.6.26-2.el7
mysql-community-libs.x86_64 0:5.6.27-2.el7
作为依赖被删除:
mysql-community-client.x86_64 0:5.6.26-2.el7
mysql-community-client.x86_64 0:5.6.27-2.el7
mysql-community-server.x86_64 0:5.6.27-2.el7
perl-DBD-MySQL.x86_64 0:4.023-5.el7
postfix.x86_64 2:2.10.1-6.el7
qt-mysql.x86_64 1:4.8.5-8.el7
redhat-lsb.x86_64 0:4.1-27.el7.centos.1
redhat-lsb-core.x86_64 0:4.1-27.el7.centos.1
redhat-lsb-cxx.x86_64 0:4.1-27.el7.centos.1
redhat-lsb-desktop.x86_64 0:4.1-27.el7.centos.1
redhat-lsb-languages.x86_64 0:4.1-27.el7.centos.1
redhat-lsb-printing.x86_64 0:4.1-27.el7.centos.1
完毕!
[root@wode004 etc]#
///
/// yum install mysql-devel
///
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
mysql-community-devel x86_64 5.6.27-2.el7 mysql56-community 3.4 M
为依赖而安装:
mysql-community-libs x86_64 5.6.27-2.el7 mysql56-community 2.0 M
事务概要
================================================================================
安装 1 软件包 (+1 依赖软件包)
总计:5.4 M
总下载量:2.0 M
安装大小:30 M
Is this ok [y/d/N]: y
Downloading packages:
mysql-community-libs-5.6.27-2.el7.x86_64.rpm | 2.0 MB 00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : mysql-community-libs-5.6.27-2.el7.x86_64 1/2
正在安装 : mysql-community-devel-5.6.27-2.el7.x86_64 2/2
验证中 : mysql-community-devel-5.6.27-2.el7.x86_64 1/2
验证中 : mysql-community-libs-5.6.27-2.el7.x86_64 2/2
已安装:
mysql-community-devel.x86_64 0:5.6.27-2.el7
作为依赖被安装:
mysql-community-libs.x86_64 0:5.6.27-2.el7
完毕!
[root@wode004 etc]#
///
/// yum install mysql
///
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
mysql-community-client x86_64 5.6.27-2.el7 mysql56-community 19 M
事务概要
================================================================================
安装 1 软件包
总下载量:19 M
安装大小:88 M
Is this ok [y/d/N]: y
Downloading packages:
mysql-community-client-5.6.27-2.el7.x86_64.rpm | 19 MB 00:48
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : mysql-community-client-5.6.27-2.el7.x86_64 1/1
验证中 : mysql-community-client-5.6.27-2.el7.x86_64 1/1
已安装:
mysql-community-client.x86_64 0:5.6.27-2.el7
完毕!
[root@wode004 ~]#
///
/// yum install mysql-server
///
[root@wode004 ~]# yum install mysql-server
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
mysql-community-server x86_64 5.6.27-2.el7 mysql56-community 58 M
事务概要
================================================================================
安装 1 软件包
总下载量:58 M
安装大小:245 M
Is this ok [y/d/N]: y
Downloading packages:
mysql-community-server-5.6.27-2.el7.x86_64.rpm | 58 MB 02:31
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : mysql-community-server-5.6.27-2.el7.x86_64 1/1
warning: /etc/my.cnf created as /etc/my.cnf.rpmnew
验证中 : mysql-community-server-5.6.27-2.el7.x86_64 1/1
已安装:
mysql-community-server.x86_64 0:5.6.27-2.el7
完毕!
[root@wode004 ~]# ls
///
/// python setup.py build
///
[root@wode004 MySQL-python-1.2.5]# python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -m64 -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing
In file included from /usr/include/mysql/my_config.h:27:0,
from _mysql.c:44:
/usr/include/mysql/my_config_x86_64.h:442:0: 警告:“HAVE_WCSCOLL”重定义 [默认启用]
#define HAVE_WCSCOLL
^
In file included from /usr/include/python2.7/pyconfig.h:6:0,
from /usr/include/python2.7/Python.h:8,
from _mysql.c:29:
/usr/include/python2.7/pyconfig-64.h:908:0: 附注:这是先前定义的位置
#define HAVE_WCSCOLL 1
^
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64/mysql -L/usr/lib64 -lmysqlclient -lpthread -lm -ldl -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so
[root@wode004 MySQL-python-1.2.5]#
///
/// python setup.py install
///
[root@wode004 MySQL-python-1.2.5]# python setup.py install
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
running build_ext
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/_mysql_exceptions.py -> build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/__init__.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/converters.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/connections.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/cursors.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/times.py -> build/bdist.linux-x86_64/egg/MySQLdb
creating build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/__init__.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/CR.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/FIELD_TYPE.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/ER.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/FLAG.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/REFRESH.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/CLIENT.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/release.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/_mysql.so -> build/bdist.linux-x86_64/egg
byte-compiling build/bdist.linux-x86_64/egg/_mysql_exceptions.py to _mysql_exceptions.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/converters.py to converters.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/connections.py to connections.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/cursors.py to cursors.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/times.py to times.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/CR.py to CR.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/FIELD_TYPE.py to FIELD_TYPE.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/ER.py to ER.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/FLAG.py to FLAG.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/REFRESH.py to REFRESH.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/CLIENT.py to CLIENT.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/release.py to release.pyc
creating stub loader for _mysql.so
byte-compiling build/bdist.linux-x86_64/egg/_mysql.py to _mysql.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/MySQL_python-1.2.5-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing MySQL_python-1.2.5-py2.7-linux-x86_64.egg
Copying MySQL_python-1.2.5-py2.7-linux-x86_64.egg to /usr/lib64/python2.7/site-packages
Adding MySQL-python 1.2.5 to easy-install.pth file
Installed /usr/lib64/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg
Processing dependencies for MySQL-python==1.2.5
Finished processing dependencies for MySQL-python==1.2.5
[root@wode004 MySQL-python-1.2.5]#