centos下源码安装mysql-5.1.53
0. 设置PATH
[root@ldap-mysql-svn-trac ~]# export PATH="$PATH:/usr/man/mysql/bin"
1. 解压mysql的源码包mysql-5.1.53.tar.gz,切换到安装目录下
[root@ldap-mysql-svn-trac mysql-5.1.53]# ./configure --prefix=/usr/man/mysql --sysconfdir=/usr/man/mysql --localstatedir=/usr/man/mysql/data --with-unix-socket-path=/usr/man/mysql/tmp/mysql.sock --with-charset=gbk --with-plugins=innobase --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static
#sysconfdir表示mysql的配置文件路径,localstatedir表示数据文件路径,socket配置和最后2
个属性主要用来提升性能
#如果要使用innodb引擎,记得加上--with-plugins=innobase
2. install
[root@ldap-mysql-svn-trac mysql-5.1.53]# make
[root@ldap-mysql-svn-trac mysql-5.1.53]# make install
3. config
[root@ldap-mysql-svn-trac mysql-5.1.53]# cp /usr/man/mysql/share/mysql/my-medium.cnf /usr/man/mysql/my.cnf
4. 切换到mysql的bin目录下,run
[root@ldap-mysql-svn-trac bin]#./mysql_install_db --basedir=/usr/man/mysql --
datadir=/usr/man/mysql/data
5. 复制/usr/man/mysql/libexec/mysqld到mysql的bin目录下,启动mysql服务
[root@ldap-mysql-svn-trac bin]# cp /usr/man/mysql/libexec/mysqld /usr/man/mysql/bin
6. run mysql service
/usr/man/mysql/bin/mysqld_safe --ledir=/usr/man/mysql/bin --log-error=/usr/man/mysql/data/t.err --datadir=/usr/man/mysql/data --socket=/usr/man/mysql/tmp/mysql.sock --pid-file=/usr/man/mysql/bin/mysqld.pid &