首先看gcc编译工具是否安装好了:
yum install -y gcc-*
相关rpm依赖包如下:
依赖包:
编译安装MySQL5.1.50
[root@xen_202_14 install]# useradd mysql
[root@xen_202_14 install]# pwd
/tmp/install
[root@xen_202_14 install]# ll
total 23224
-rw-r--r-- 1 root root 23750564 Mar
4 09:51 mysql-5.1.50.tar.gz
[root@xen_202_14 install]# tar -xzvf mysql-5.1.50.tar.gz
[root@xen_202_14 install]# ll
total 23228
drwxrwxrwx 33 7155 wheel
4096 Mar
4 11:07 mysql-5.1.50
-rw-r--r--
1 root root
23750564 Mar
4 09:51 mysql-5.1.50.tar.gz
[root@xen_202_14 mysql-5.1.50]#./configure
--prefix=/usr/local/mysql --datadir=/data/mysql/data --enable-assembler --with-client-ldflags=--all-static --with-unix-socket --with-charset=utf8 --enable-thread-safe-client --with-pthread --without-debug --with-big-tables --enable-community-features --enable-profiling --enable-local-infile --with-fast-mutexes --with-plugins=partition,federated,ndbcluster,innobase,csv,blackhole,myisam,innodb_plugin
[root@xen_202_14 mysql-5.1.50]# make
[root@xen_202_14 mysql-5.1.50]# strip sql/mysqld
[root@xen_202_14 mysql-5.1.50]# make install
[root@xen_202_14 mysql-5.1.50]# cp support-files/my-medium.cnf /etc/my.cnf
[root@xen_202_14 mysql-5.1.50]# cp support-files/mysql.server /etc/init.d/mysqld
[root@xen_202_14 mysql-5.1.50]# chmod u+x /etc/init.d/mysqld
[root@xen_202_14 mysql-5.1.50]# chkconfig --add mysqld (chkconfig中无此项服务时执行)
[root@xen_202_14 mysql-5.1.50]# /usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/data/mysql/data
[root@xen_202_14 mysql-5.1.50]# chown -R mysql.mysql /data/mysql/
[root@xen_202_14 mysql-5.1.50]# service
mysqld start
[root@xen_202_14 mysql-5.1.50]# /usr/local/mysql/bin/mysqladmin -u root password '123456'
[root@xen_202_14 mysql-5.1.50]# echo "PATH=\"/usr/local/mysql/bin:/data/bin/:\$PATH\"" >> /etc/profile
[root@xen_202_14 mysql-5.1.50]# export PATH="/usr/local/mysql/bin:/data/bin/:$PATH"
[root@xen_202_14 mysql-5.1.50]# mysql -uroot -p123456
Welcome to the MySQL monitor.
Commands end with ; or \g.
Your MySQL connection id is 26287
Server version: 5.1.50-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>