Techyou labs
真正的爱应该超越生命的长度、心灵的宽度、 灵魂的深度
常用标签

下载mysql源码包到指定目录

molyx:~# tar zxvf mysql-5.1.42.tar.gzmolyx:~# cd mysql-5.1.42

添加mysql运行用户/用户组

molyx:~# groupadd mysqldmolyx:~# useradd -g mysqld -s /bin/false -c "Mysql Server Runner" mysqld

创建mysql安装目录和数据存放目录

molyx:~# mkdir /usr/local/mysqldmolyx:~# mkdir /var/mysqldata

安装gcc和ncurses

molyx:~# apt-get install gccmolyx:~/ncurses-5.7# apt-get install g++molyx:~# apt-get install libncurses5-dev

编译mysql

./configure --prefix=/usr/local/mysqld --enable-assembler --with-charset=utf8 --with-extra-charsets=all --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=max-no-ndb --enable-shared --with-tcp-port=3306 --with-mysqld-user=mysqld --with-low-memory --with-mysqlmanager

安装并初始化环境

molyx:/home/web_package/mysql-5.1.42# make molyx:/home/web_package/mysql-5.1.42# make installmolyx:/home/web_package/mysql-5.1.42# cp support-files/my-medium.cnf /usr/local/mysqld/etc/my.cnf

更改目录权限

molyx:/home/web_package/mysql-5.1.42# chown -R mysqld /usr/local/mysqld molyx:/home/web_package/mysql-5.1.42# chown -R mysqld /var/mysqldata molyx:/home/web_package/mysql-5.1.42# chown -R mysqld:mysqld /usr/local/mysqld molyx:/home/web_package/mysql-5.1.42# chown -R mysqld:mysqld /var/mysqldata   molyx:/home/web_package/mysql-5.1.42# chmod 711 /usr/local/mysqld molyx:/home/web_package/mysql-5.1.42# chmod 711 /var/mysqldata

初始化数据库

molyx:/home/web_package/mysql-5.1.42# /usr/local/mysqld/bin/mysql_install_db --user=mysqld --datadir=/var/mysqldata --basedir=/usr/local/mysqld --skip-name-resolve --defaults-file=/usr/local/mysqld/etc/my.cnf

参考资料http://tianzui.blog.bokee.net/bloggermodule/blog_viewblog.do?id=3901792http://xfenoo.blog.51cto.com/747433/255572错误解决:

g++: yes: No such file or directorymake[3]: *** [mysqld] Error 1make[3]: Leaving directory `/home/mysql/src/mysql-5.1.41/sql'make[2]: *** [all-recursive] Error 1make[2]: Leaving directory `/home/mysql/src/mysql-5.1.41/sql'make[1]: *** [all] Error 2make[1]: Leaving directory `/home/mysql/src/mysql-5.1.41/sql'make: *** [all-recursive] Error 1

加入参数CXXFLAGS="-fPIC"

CXXFLAGS="-fPIC" ./configure --prefix=/usr/local/mysqld --enable-assembler --with-charset=utf8 --with-extra-charsets=all --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=max-no-ndb --enable-shared --with-tcp-port=3306 --with-mysqld-user=mysqld --with-low-memory --with-mysqlmanager
暂无评论

添加新评论