免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1111 | 回复: 0
打印 上一主题 下一主题

在ubuntu6.10上安装mysql4(已有mysql5) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-09-02 00:34 |只看该作者 |倒序浏览
解压mysql4.0.26
[email=root@www:/db]root@www:/db[/email]
# tar zxvf mysql-4.0.26.tar.gz
备份mysql5的数据目录
[email=root@www:/db]root@www:/db[/email]
# tar czvf mysql5.data.tar.gz mysql5
编译
[email=root@www:/db]root@www:/db[/email]
# cd mysql-4.0.26
[email=root@www:/db/mysql-4.0.26]root@www:/db/mysql-4.0.26[/email]
# ./configure --prefix=/db/mysql4
最后提示:
checking "LinuxThreads"... "Not found"
configure: error: This is a linux system and Linuxthreads was not
found. On linux Linuxthreads should be used.  Please install Linuxthreads
(or a new glibc) and try again.  See the Installation chapter in the
Reference Manual for more information.
怎么会没有Linuxthreads?查看
[email=root@www:/db/mysql-4.0.26]root@www:/db/mysql-4.0.26[/email]
# gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --
with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
也许是gcc版本太新的原因?上网一查,是因为新内核使用了NTPL这种先进的线程处理方式,于是就这样:
[email=root@www:/db/mysql-4.0.26]root@www:/db/mysql-4.0.26[/email]
# cp /usr/include/pthread.h /usr/include/pthread.h.bak
[email=root@www:/db/mysql-4.0.26]root@www:/db/mysql-4.0.26[/email]
# echo '/* Linuxthreads */' >> /usr/include/pthread.h
然后编译,并且加了点参数
[email=root@www:/db/mysql-4.0.26]root@www:/db/mysql-4.0.26[/email]
# ./configure --prefix=/db/mysql4 --with-unix-socket-path=/db/mysql4/mysql.sock --with-tcp-port=3304
--with-low-memory
在检测Linuxthreads地方显示为Found,但后来还是停下了,
checking whether signal handlers are of type void... yes
checking for tgetent in -lncurses... no
checking for tgetent in -lcurses... no
checking for tgetent in -ltermcap... no
checking for termcap functions library... configure: error: No curses/termcap li
brary found
看来要装ncurses,
[email=root@www:/db/mysql-4.0.26]root@www:/db/mysql-4.0.26[/email]
# apt-get install ncurses
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
Reading state information... 完成
现在没有可用的软件包 ncurses,但是它被其它的软件包引用了。
这可能意味着这个缺失的软件包可能已被废弃,
或者只能在其他发布源中找到
E: 软件包 ncurses 还没有可供安装的候选者
[email=root@www:/db/mysql-4.0.26]root@www:/db/mysql-4.0.26[/email]
# apt-get install curses
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
Reading state information... 完成
E: 无法找到软件包 curses
看来没搞对,那这样再试:
[email=root@www:/db/mysql-4.0.26]root@www:/db/mysql-4.0.26[/email]
# apt-get install libncurses5-dev
可以下载了,然后再configure就可以了,继续
[email=root@www:/db/mysql-4.0.26]root@www:/db/mysql-4.0.26[/email]
# make
[email=root@www:/db/mysql-4.0.26]root@www:/db/mysql-4.0.26[/email]
# make install
[email=root@www:/db/mysql-4.0.26]root@www:/db/mysql-4.0.26[/email]
# cd ..
[email=root@www:/db]root@www:/db[/email]
# cd mysql4
确认一下my.cnf的内容,
[email=root@www:/db/mysql4]root@www:/db/mysql4[/email]
# more share/mysql/my-small.cnf
因为ubuntu6.10的mysql5的my.cnf文件位置不是通常的/etc/,而是/etc/mysql,所以可以放心的复制mysql4的my.cnf到/etc/,且因为mysql4只是
为了兼容原有的一个站点,访问量也小,所以用small配置就行了
[email=root@www:/db/mysql4]root@www:/db/mysql4[/email]
# cp share/mysql/my-small.cnf /etc/my.cnf
初始化数据库
[email=root@www:/db/mysql4]root@www:/db/mysql4[/email]
# bin/mysql_install_db --user=mysql
按mysql手册说法,应该再
shell> chown -R root  .
shell> chown -R mysql var
shell> chgrp -R mysql .
但由于我当时指定了sock为.下,所以应该改成mysql,不注意就打成了
[email=root@www:/db/mysql4]root@www:/db/mysql4[/email]
# chown -R mysql .
其实本应该
chown mysql .
所以干脆重作,
[email=root@www:/db/mysql4]root@www:/db/mysql4[/email]
# chown -R root .
[email=root@www:/db/mysql4]root@www:/db/mysql4[/email]
# chown -R mysql var
[email=root@www:/db/mysql4]root@www:/db/mysql4[/email]
# chgrp -R mysql
[email=root@www:/db/mysql4]root@www:/db/mysql4[/email]
# chown mysql .
启动服务器
[email=root@www:/db/mysql4]root@www:/db/mysql4[/email]
# bin/mysqld_safe --user=mysql &
客户端连接一下
[email=root@www:/db/mysql4]root@www:/db/mysql4[/email]
# bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.26
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
看来一切良好,关闭服务器
[email=root@www:/db/mysql4]root@www:/db/mysql4[/email]
# bin/mysqladmin shutdown
然后修改/etc/rc.local,在exit 0之前加入/db/mysql4/share/mysql/mysql.server start,这样就可以开机自动启动了.
剩下的事就是设定root密码,建库等了.要导入原来的备份数据库,可以这样,
/db/mysql4/bin/mysql -u username -p database





本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/4891/showart_372622.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP