ubuntu安装mysql

1.首先你要确定ubuntu更新源能用,本文测试的ubuntu 14.04的源,低版本的ubuntu没试过。毕竟劳资不是测试人员。

为了安全起见 cp /etc/apt/source.list /etc/apt/source.list.bak

下面的是ubuntu 14.04的源,(其他版本的源请自己查找)将下面的内容写到/etc/apt/source.list

deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiversedeb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

2. sudo apt-get update

3.sudo apt-get install mysql-python

发现报错了:

sh: mysql_config: not found

traceback (most recent call last):

file “setup.py”, line 15, in

metadata, options = get_config()

file “/home/zhxia/apps/source/mysql-python-1.2.3/setup_posix.py”, line 43, in get_config

libs = mysql_config(“libs_r”)

file “/home/zhxia/apps/source/mysql-python-1.2.3/setup_posix.py”, line 24, in mysql_config

raise environmenterror(“%s not found” % (mysql_config.path,))

environmenterror: mysql_config not found

4.具体原因是安装程序在/usr/bin/下找不到mysql_config文件。

在网上查的解决方法,一般是说你没有libmysqld-dev 或libmysqlclient-dev ,可是查了一下发现都存在。

ubuntu安装mysql-python

5.首先一个重要的python-dev一般都没有安装,所以需要sudo apt-get install python-dev

完事继续安装mysql-python,发现还是不行。

6.重装libmysqlclient-dev,

奇迹终于出现了:

ubuntu安装mysql-python

更多ubuntu相关信息见ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2

本文永久更新链接地址:http://www.linuxidc.com/linux/2014-11/109246.htm

Posted in 未分类

发表评论