At present, all major portal websites tend to use MySQL to a certain extent. In addition to the I/O/E campaign advocated by the Alibaba system, we must correct the earlier view that we have always despised MySQL, as a database practitioner, we must be familiar with more than two types of rdbms databases. Therefore, we will continue to focus on Oracle and MySQL as an extension! This article mainly records the compilation and Installation Process of MySQL 5.1 on the linux platform. MySQL versions 5.5 and 5.1 are quite different. After MySQL, the partition table function is provided, in version 5.5, the default storage engine is changed to innodb, and before version 5.1 is myisam.
1: Install necessary rpm packages and create a MySQL user group. The operating system platform used in this article is RHEL5.4.
- [root@ www.bkjia.com ~]# grep -v '^#' /etc/yum.repos.d/base.repo |grep -v '^$'
- [base]
- name=base
- baseurl=file:///mnt/Server
- gpgcheck=0
- enable=1
-
- [root@ www.bkjia.com ~]# mount /dev/cdrom /mnt
- mount: block device /dev/cdrom is write-protected, mounting read-only
- [root@ www.bkjia.com ~]# yum -y install gcc gcc-c++ gcc-g77 autoconf automake \
- zlib* fiex** libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
-
- [root@ www.bkjia.com ~]# id mysql
- uid=27(mysql) gid=27(mysql) groups=27(mysql)
2: Download The cmake and mysql source code packages for compilation and installation. mysql 5.5 must be compiled using cmake.
- [root@ www.bkjia.com ~]# cd /usr/local/src/tarbag/
- [root@ www.bkjia.com tarbag]# wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
- [root@ www.bkjia.com tarbag]# wget http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.25.tar.gz
-
- [root@ www.bkjia.com tarbag]# tar -zxvpf cmake-2.8.4.tar.gz -C ../software/
- [root@ www.bkjia.com tarbag]# tar -zxvpf mysql-5.5.25.tar.gz -C ../software/
- [root@ www.bkjia.com tarbag]# cd ../software/cmake-2.8.4/
- [root@ www.bkjia.com cmake-2.8.4]# ./configure --prefix=/usr/local/cmake2.8.4 && make && make install
-
- [root@ www.bkjia.com ~]# grep PATH .bash_profile
- PATH=$PATH:$HOME/bin:/usr/local/cmake2.8.4/bin:$PATH
- export PATH
- [root@ www.bkjia.com ~]# . .bash_profile
-
- [root@ www.bkjia.com ~]# cd /usr/local/src/software/mysql-5.5.25/
- [root@ www.bkjia.com mysql-5.5.25]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.5.25 \
- -DMYSQL_DATADIR=/mydata \
- -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
- -DWITH_INNOBASE_STORAGE_ENGINE=1 \
- -DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all \
- -DDEFAULT_CHARSET=utf8 \
- -DDEFAULT_COLLATION=utf8_general_ci \
- -DWITH_DEBUG=0
-
- [root@ www.bkjia.com mysql-5.5.25]# make && make install
3. initialize the mysql service.
- [root@ www.bkjia.com mysql-5.5.25]# cp support-files/my-large.cnf /etc/my.cnf
- [root@ www.bkjia.com mysql-5.5.25]# cp support-files/mysql.server /etc/init.d/mysqld
- [root@ www.bkjia.com mysql-5.5.25]# chmod +x /etc/init.d/mysqld
- [root@ www.bkjia.com mysql-5.5.25]# chkconfig --add mysqld
-
- [root@ www.bkjia.com mysql-5.5.25]# sh ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql5.5.25/ --datadir=/mydata/
-
- [root@ www.bkjia.com mysql-5.5.25]# service mysqld start
- Starting MySQL...[ OK ]
-
- [root@ www.bkjia.com ~]# echo '/usr/local/mysql5.5.25/include/' >> /etc/ld.so.conf
- [root@ www.bkjia.com ~]# echo '/usr/local/mysql5.5.25/lib/' >> /etc/ld.so.conf
- [root@ www.bkjia.com ~]# ldconfig