快速业务通道

mysql编译安装及其各参数详解、常见错误分析

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-03-28

环境:yum install make gcc gcc-c libxml2 libxml2-devel libmcrypt libmcrypt-devel libtool-ltdl apr apr-* ncurses ncurses-* 安装mysql: #tar -zxvf mysql-5.1.53.tar.gz #cd mysql-5.1.53 #/usr/sbin/groupadd mysql #/usr/sbin/useradd mysql -g mysql #./configure --prefix=/opt/mysql --localstatedir=/opt/mysql/data/ --with-server-suffix=-enterprise-gpl --without-debug --with-big-tables --with-extra-charsets=gb2312,utf8,GBK --with-extra-charsets=all --with-pthread --enable-thread-safe-client --enable-static --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-innodb --without-ndb-debug --without-isam #make(时间会很长、优化的比较多) #make install #mkdir –p /opt/mysql/data #cd /opt/mysql #bin/mysql_install_db --user=mysql 注:Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /opt/mysql/bin/mysqladmin -u root password ''new-password'' /opt/mysql/bin/mysqladmin -u root -h xsl228 password ''new-password'' Alternatively you can run: /opt/mysql/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /opt/mysql ; /opt/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /opt/mysql/mysql-test ; perl mysql-test-run.pl Please report any problems with the /opt/mysql/bin/mysqlbug script! #chown -R mysql.mysql . #chown -R mysql.mysql /opt/mysql/data #cp share/mysql/my-medium.cnf /etc/my.cnf #cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld #chmod 755 /etc/rc.d/init.d/mysqld #/opt/mysql/bin/mysqld_safe --user=mysql & 如果mysql不成功,查看下mysql的错误日志 Mysql常见错误: 1.[Warning] ''--skip-locking'' is deprecated and will be removed in a future release. Please use ''--skip-external-locking'' instead. 解决方式:#vi /etc/my.cnf 将skip-locking注释掉,然后添加一行:skip-external-locking 2. 110830 23:38:05 [ERROR] Aborting 110830 23:38:05 [Note] /opt/mysql/libexec/mysqld: Shutdown complete 110830 23:38:05 mysqld_safe mysqld from pid file /opt/mysql/data/xsl231.pid ended 110830 23:38:09 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/data /opt/mysql/libexec/mysqld: File ''./mysql-bin.index'' not found (Errcode: 13) 解决方式:初始化的时候添加bin/mysql_install_db --user=mysql 启动的时候:/opt/mysql/bin/mysqld_safe --user=mysql & (--with-server-suffix=-enterprise-gpl 给MySQL加个后缀名,在用mysql登录的时候在版本号的后面可以看到;

--without-debug

去除诊断模式,如果用--with-debug=full编译,大多数查询慢20%

--with-big-tables 大表支持

--with-extra-charsers=gbk,gb2312,utf8 设置支持gbk,gb2312,utf8字符集

--with-pthread 强制使用pthread库(posix线程库)

--enable-thread-safe-client 以线程方式编译客户端

--enable-static

--with-client-ldflags=-all-static

--with-mysqld-ldflags=-all-static

以静态方式编译客户端和服务端,能提高13%性能

--enable-assembler 使用一些字符函数来汇编版本

--without-ndb-debug 取消导航调试

--without-innodb


去掉innodb表支持,innodb是一种支持事务处理的表,适合企业级应用

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号