欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

centos5.10下源码编译mysql5.1.73

程序员文章站 2022-06-16 21:10:35
...

1. groupadd mysql 2. useradd -g mysql mysql 3. tar -zxvf mysql-5.1.73.tar.gz 4. cd mysql-5.1.73 5. ./configure --prefix=/usr/local/mysql --localstatedir=/data/mysql_db --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --w

1. groupadd mysql

2. useradd -g mysql mysql

3. tar -zxvf mysql-5.1.73.tar.gz

4. cd mysql-5.1.73

5. ./configure --prefix=/usr/local/mysql --localstatedir=/data/mysql_db --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-extra-charsets=utf8,gbk --with-plugins=innobase,myisam --with-server-suffix=-community --with-unix-socket-path=/usr/local/mysql/sock/mysql.sock
--enable-thread-safe-client --enable-assembler --enable-profiling -without-embedded-server --without-debug --without-bench

./configure --prefix=/usr/local/mysql //指定mysql安装路径
--localstatedir=/data/mysql_db //指定数据库的库文件存放路径
--with-mysqld-ldflags=-all-static //以静态方式编译服务器端
--with-client-ldflags=-all-static //以静态方式编译客户端
--with-extra-charsets=utf8,gbk //添加utf8、gbk字符集
--with-plugins=innobase,myisam //添加mysql存储引擎
--with-server-suffix=-community //为mysqld版本字符串添加后缀
--with-unix-socket-path=/usr/local/mysql/sock/mysql.sock
--enable-thread-safe-client //以线程方式编译客户端,提高性能
--enable-assembler //使用汇编,提高性能
--enable-profiling //启用profile功能
--without-embedded-server //去除embedded
--without-debug //去除debug模式,提高性能
--without-bench //去除bench模式,提高性能

6. make && make install

7.cp support-files/my-medium.cnf /etc/my.cnf

8. /usr/local/mysql/bin/mysql_install_db --user=mysql &

9. /usr/local/mysql/bin/mysqld_safe -user=mysql &

10. cp support-files/mysql.server /etc/rc.d/init.d/mysqld

11. chmod 700 /etc/rc.d/init.d/mysqld

12. chkconfig --add mysqld

13. chkconfig --level 345 mysqld on

14. service mysqld start

15./usr/local/mysql/bin/mysqladmin -uroot password yourpassword

16./usr/local/mysql/bin/mysql -uroot -p yourpassword