Ubuntu 10.10 源码安装MySQL 5.1.34 |
发布时间: 2012/8/17 17:33:04 |
最近将系统重新安装了Ubuntu 10.10系统,需要重新编译安装Mysql,源码版本是5.1.34 很折腾,不知道10.10的系统改了些什么东西,装软件都这么不顺利 在这里把发生的问题都记录一下: 步骤如下: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1. 安装Ubuntu 10.10下的编译工具 sudo apt-get install build-essentials 安装后gcc 和 g++ 的版本都是 (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2. ./configure --prefix=/usr/local/mysql ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3. make 在make时出错,最后几行如下: make[2]: *** [do_abi_check] Error 1 make[2]: Leaving directory `/home/ice/Documents/software/mysql/src/mysql-5.1.34' make[1]: *** [abi_check] Error 2 make[1]: Leaving directory `/home/ice/Documents/software/mysql/src/mysql-5.1.34' make: *** [all-recursive] Error 1 参照 http://bugs.mysql.com/bug.php?id=52514 中对此问题的说明,将Makefile中最后面的do_abi_check注释掉 跳过ABI Check 重新make成功 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4. sudo make install 顺利通过 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5. 到目录/usr/local/mysql下执行如下命令 (ice是我的用户名)
chgrp -R ice . ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6. 到目录/usr/local/bin 下 运行mysql_install_db --basedir=/usr/local/mysql \ --datadir=/usr/local/mysql/data ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7. 切到目录libexec下 ------------------------------------------------------- 执行命令 ./mysqld 产生如下错误 101215 10:09:07 [ERROR] Can't find messagefile '/usr/share/mysql/english/errmsg.sys' 问题的原因,应该是自己没有定义一个my.cnf配置文件,如果不给自己的配置文件,系统就会用默认的配置,然后就会产生上面的错误 将源码中的 support_files 文件夹下的 my_small.cnf 复制到 /etc/my.cnf下,并增加一个参数 language = /usr/local/mysql/share/mysql/english -------------------------------------------------------- 运行 ./mysqld 还有错: 101215 2:25:47 [Warning] Can't create test file /var/lib/mysql/ice-ThinkPad-R400.lower-test 101215 2:25:47 [Warning] Can't create test file /var/lib/mysql/ice-ThinkPad-R400.lower-test ./mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2) 101215 2:25:47 [ERROR] Aborting 101215 2:25:47 [Note] ./mysqld: Shutdown complete 未找到原因,查阅官方文档http://dev.mysql.com/doc/refman/5.1/en/starting-server.html 发现中间有这么一句话: When the mysqld server starts, it changes location to the data directory. 所以估计上面的错误是因为没有指定datadir参数,系统默认数据文件夹是在 /var/lib/mysql/ 的原故吧 再一次运行命令 ./mysqld --datadir=/usr/local/mysql/data 上面的错误没有了 将这个参数也加到 /etc/my.cnf 配置文件中 -------------------------------------------------------- 运行 ./mysqld 发生如下错误 101215 11:12:31 [ERROR] Can't start server : Bind on unix socket: No such file or directory 101215 11:12:31 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ? 101215 11:12:31 [ERROR] Aborting 纠结,怎么不断的有错误,继续在网上搜索终于找到了问题的根源所在 在Ubuntu下,还有一个这样的配置文件 /etc/mysql/my.cnf 文件中有下面几行: user= mysql socket= /var/run/mysqld/mysqld.sock port= 3306 basedir= /usr datadir= /var/lib/mysql tmpdir= /tmp 这个配置文件是系统自己带的,原来上面好多问题都是这个隐藏的配置文件在搞鬼,唉,折腾了好长时间,终于找到问题根源了! 将/etc/mysql/my.cnf 改为 /etc/mysql/my.cnf.backup 再次运行 ./mysqld 101215 11:54:11 [Note] Event Scheduler: Loaded 0 events 101215 11:54:11 [Note] ./mysqld: ready for connections. Version: '5.1.34' socket: '/tmp/mysql.sock' port: 3306 Source distribution ready for connections 终于成功了! 祝贺一下自己! ----------------------------------------------------------------- 注:这两天又查了一些资料发现出现这么多问题的原因是由于gcc4.3升级到gcc4.4版本的改动,用gcc4.4编译,不仅ABI_CHECK出现问题,安装后执行mysql自带的测试时还有一些测试通不过,将编译器降为gcc4.3和g++4.3后,源码安装过程中就不会出现ABI_CHECK不通过的问题,编译成功后能通过所有的测试 本文出自:亿恩科技【www.enkj.com】 |