技术头条 - 一个快速在微博传播文章的方式     搜索本站
您现在的位置首页 --> Linux --> 编译安装mysql 5.141源代码,常见两处错误解决

编译安装mysql 5.141源代码,常见两处错误解决

浏览:2121次  出处信息

first u must add users for mysql account and group form mysqld

1 groupadd mysql

useradd -g mysql mysql
2 wget source code
http://dev.mysql.com/downloads/mysql/5.1.html 可以到此页面找到最下面
wget
如果是zip 文件 unzip mysql-1.41.zip
或者tar -xzvf mysql-5.1.41.tar.gz  cd mysql-5.1.41
编译安装可以优化许多参数,如静态编译,去掉自己不用字符集,如果不用innodb 也可以去掉。根据自己的环境及需要使用的option
量身打造mysql编译安装参数,据说有些选项可以调高mysql的性能。
./configure --prefix=/usr/local/mysql/ --with-comment=Source
 --with-server-suffix=liufb--without-debug --with-charset=utf8
--with-extra-charsets=latin1,gbk --enable-thread-safe-client
 --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static
 --with-mysqld-libs=-all-static --enable-assembler
--without-innodb --with-unix-socket-path=/usr/local/mysql/sock/mysql.sock
如果出现checking for termcap functions library… configure: error: No curses/termcap library found 错误,安装ncurses就可以解决
如果是在debian或者ubuntu下这可以直接:aptitude install libncurses5-dev
或者手工编译下载安装,方法可以google下
编译 安装
# make &&  install
 cd /usr/local/mysql
 scripts/mysql_install_db --user=mysql
如果出现错误:
FATAL ERROR: Could not find mysqld
The following directories were searched:
        /usr/libexec
        /usr/sbin
        /usr/bin
是因为原来装有/etc/mysql/my.cnf引起的。将/etc/mysql/my.cnf删除
 chown -R root  /usr/local/mysql;
 chown -R mysql /usr/local/mysql/var;
 chgrp -R mysql /usr/local/mysql
 cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
 /usr/local/mysql/bin/mysqladmin -u root password '123456'

直接启动:/usr/local/mysql/share/mysql/mysql.server start
/usr/local/mysql/share/mysql/mysql.server stop
或者:
把mysql/bin添加到$PATH变量中:
export PATH=/usr/local/mysql/bin/:$PATH
/etc/init.d/mysqld start
mysql -u root -p12346

建议继续学习:

  1. 从C语言的Hello World说起    (阅读:6122)
  2. 关于PHP的编译和执行分离    (阅读:5595)
  3. 如何在Windows下编译或调试MySQL    (阅读:3434)
  4. 内核编译升级失败了以后的处理方案    (阅读:2840)
  5. 如何在AIX中编译Perl    (阅读:2248)
  6. 在编译php-fpm0.6的时候需要注意的一些问题    (阅读:1916)
  7. GCC编译错误    (阅读:1848)
  8. 有关最近GCC编译出现的firstdefine问题    (阅读:1711)
  9. 大搜车前端开发模式:被动编译和主动编译    (阅读:1146)
  10. C++模板”>>”编译问题与词法消歧设计    (阅读:979)
QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
后一篇:AWK介绍 >>
© 2009 - 2024 by blogread.cn 微博:@IT技术博客大学习

京ICP备15002552号-1