MySQL安装后仍不能用于开发,找不到mysql.h

重复贴和参考价值不大的帖子,版主维护
回复
绿色植物
帖子: 35
注册时间: 2008-12-22 19:40
送出感谢: 0
接收感谢: 0

MySQL安装后仍不能用于开发,找不到mysql.h

#1

帖子 绿色植物 » 2008-12-27 20:33

我安装了server和client,显示版本5.05。
我还不知道怎样编译用c连接mysql的程序,用以下命令试了下,
g++ test.cpp -I /user/include/mysql -L /user/lib/mysql -l mysqlclient
提示一堆错误,主要是:
mysql.h: No such file or directory
在/user/include中没发现mysql的东西,/user/lib下也没有。所以,找不到是一定的了。

有人说,要想用于数据库开发,不仅要安装server和client,还要装mysql-devel,而且三者版本要相同。官方网站上没找到mysql-devel 5.05这个包。推荐下载5.10的,我就选了下面这个:
Linux x86 generic RPM (dynamically linked)
可他下面有8个子包:Server, Benchmark/test suites, Client programs, Libraries and header files, Shared client libraries, Shared compatibility libraries, Debug info.
我把它们下载到了桌面上,rpm -ivh MySQL-server-5.1.30-0.glibc23.i386.rpm之后,提示:
error: Failed dependencies:
/bin/sh is needed by MySQL-server-5.1.30-0.glibc23.i386
/sbin/chkconfig is needed by MySQL-server-5.1.30-0.glibc23.i386
/usr/bin/perl is needed by MySQL-server-5.1.30-0.glibc23.i386
/usr/sbin/groupadd is needed by MySQL-server-5.1.30-0.glibc23.i386
/usr/sbin/useradd is needed by MySQL-server-5.1.30-0.glibc23.i386
coreutils is needed by MySQL-server-5.1.30-0.glibc23.i386
grep is needed by MySQL-server-5.1.30-0.glibc23.i386
libc.so.6 is needed by MySQL-server-5.1.30-0.glibc23.i386
libc.so.6(GLIBC_2.0) is needed by MySQL-server-5.1.30-0.glibc23.i386
libc.so.6(GLIBC_2.1) is needed by MySQL-server-5.1.30-0.glibc23.i386
libc.so.6(GLIBC_2.1.2) is needed by MySQL-server-5.1.30-0.glibc23.i386
libc.so.6(GLIBC_2.1.3) is needed by MySQL-server-5.1.30-0.glibc23.i386
libc.so.6(GLIBC_2.2) is needed by MySQL-server-5.1.30-0.glibc23.i386
libc.so.6(GLIBC_2.3) is needed by MySQL-server-5.1.30-0.glibc23.i386
libcrypt.so.1 is needed by MySQL-server-5.1.30-0.glibc23.i386
libcrypt.so.1(GLIBC_2.0) is needed by MySQL-server-5.1.30-0.glibc23.i386
libdl.so.2 is needed by MySQL-server-5.1.30-0.glibc23.i386
libdl.so.2(GLIBC_2.0) is needed by MySQL-server-5.1.30-0.glibc23.i386
libdl.so.2(GLIBC_2.1) is needed by MySQL-server-5.1.30-0.glibc23.i386
libm.so.6 is needed by MySQL-server-5.1.30-0.glibc23.i386
libm.so.6(GLIBC_2.0) is needed by MySQL-server-5.1.30-0.glibc23.i386
libm.so.6(GLIBC_2.1) is needed by MySQL-server-5.1.30-0.glibc23.i386
libnsl.so.1 is needed by MySQL-server-5.1.30-0.glibc23.i386
libpthread.so.0 is needed by MySQL-server-5.1.30-0.glibc23.i386
libpthread.so.0(GLIBC_2.0) is needed by MySQL-server-5.1.30-0.glibc23.i386
libpthread.so.0(GLIBC_2.1) is needed by MySQL-server-5.1.30-0.glibc23.i386
libpthread.so.0(GLIBC_2.2) is needed by MySQL-server-5.1.30-0.glibc23.i386
libpthread.so.0(GLIBC_2.3.2) is needed by MySQL-server-5.1.30-0.glibc23.i386
perl(DBI) is needed by MySQL-server-5.1.30-0.glibc23.i386
perl(Data::Dumper) is needed by MySQL-server-5.1.30-0.glibc23.i386
perl(File::Basename) is needed by MySQL-server-5.1.30-0.glibc23.i386
perl(File::Copy) is needed by MySQL-server-5.1.30-0.glibc23.i386
perl(File::Path) is needed by MySQL-server-5.1.30-0.glibc23.i386
perl(File::Temp) is needed by MySQL-server-5.1.30-0.glibc23.i386
perl(Getopt::Long) is needed by MySQL-server-5.1.30-0.glibc23.i386
perl(POSIX) is needed by MySQL-server-5.1.30-0.glibc23.i386
perl(Sys::Hostname) is needed by MySQL-server-5.1.30-0.glibc23.i386
perl(strict) is needed by MySQL-server-5.1.30-0.glibc23.i386
perl(vars) is needed by MySQL-server-5.1.30-0.glibc23.i386
procps is needed by MySQL-server-5.1.30-0.glibc23.i386
真愁人,提示中的这些好像不是软件包,而是某个软件中的一些部分,我真不知道怎么装了 :em19
ygf
帖子: 458
注册时间: 2006-11-27 12:25
送出感谢: 0
接收感谢: 0

Re: MySQL安装后仍不能用于开发,找不到mysql.h

#2

帖子 ygf » 2008-12-27 23:32

用新立德安装libmysqlclient15-dev,是5.0.67版的。
头像
yjsword
帖子: 524
注册时间: 2007-03-14 20:33
来自: 南京
送出感谢: 0
接收感谢: 0
联系:

Re: MySQL安装后仍不能用于开发,找不到mysql.h

#3

帖子 yjsword » 2008-12-28 13:02

lZ貌似不是用的ubuntu,这个需要安装mysql-devel这个包,或者直接下载mysql的源码编译
For Linux
http://blog.yjsword.com/
南無觀世音菩萨
绿色植物
帖子: 35
注册时间: 2008-12-22 19:40
送出感谢: 0
接收感谢: 0

Re: MySQL安装后仍不能用于开发,找不到mysql.h

#4

帖子 绿色植物 » 2008-12-28 20:56

yjsword 写了:lZ貌似不是用的ubuntu,这个需要安装mysql-devel这个包,或者直接下载mysql的源码编译
谢谢你的留言。 :em51
我装的是ubuntu8.04。确如二楼所说,再安装一个libmysqlclient15-dev(MySQL database development files.)即可。即:mysql-server+mysql-client+libmysqlclient15-dev。
安装时都提示有依赖错误,aptitude install即可。
绿色植物
帖子: 35
注册时间: 2008-12-22 19:40
送出感谢: 0
接收感谢: 0

Re: MySQL安装后仍不能用于开发,找不到mysql.h

#5

帖子 绿色植物 » 2008-12-28 20:58

ygf 写了:用新立德安装libmysqlclient15-dev,是5.0.67版的。
按照你的解答,问题已解决,谢谢! :em50 :em63 :em61
头像
yjsword
帖子: 524
注册时间: 2007-03-14 20:33
来自: 南京
送出感谢: 0
接收感谢: 0
联系:

Re: MySQL安装后仍不能用于开发,找不到mysql.h

#6

帖子 yjsword » 2008-12-28 22:55

绿色植物 写了:我把它们下载到了桌面上,rpm -ivh MySQL-server-5.1.30-0.glibc23.i386.rpm之后,提示:
error: Failed dependencies:
绿色植物 写了:我装的是ubuntu8.04。
ubuntu里用rpm的不是很多啊
:em06 :em06 :em06
For Linux
http://blog.yjsword.com/
南無觀世音菩萨
绿色植物
帖子: 35
注册时间: 2008-12-22 19:40
送出感谢: 0
接收感谢: 0

Re: MySQL安装后仍不能用于开发,找不到mysql.h

#7

帖子 绿色植物 » 2008-12-29 9:51

ubuntu里最常用的是不是deb?我在mysql官网上看到的大部分都是rpm的,而且没有专门为ubuntu提供的包,就随便找了一个。呵呵,我是只笨鸟 :em02
回复

回到 “归档贴”