Compiling and installing MySQL 5.5 on Linux [RHEL5.4]

Source: Internet
Author: User

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.

 
 
  1. [root@ www.bkjia.com ~]# grep -v '^#' /etc/yum.repos.d/base.repo |grep -v '^$'  
  2. [base]  
  3. name=base 
  4. baseurl=file:///mnt/Server  
  5. gpgcheck=0 
  6. enable=1 
  7.  
  8. [root@ www.bkjia.com ~]# mount /dev/cdrom /mnt  
  9. mount: block device /dev/cdrom is write-protected, mounting read-only  
  10. [root@ www.bkjia.com ~]# yum -y install gcc gcc-c++ gcc-g77 autoconf automake \  
  11. zlib* fiex** libxml*  ncurses-devel libmcrypt* libtool-ltdl-devel*  
  12.  
  13. [root@ www.bkjia.com ~]# id mysql  
  14. 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.

 
 
  1. [root@ www.bkjia.com ~]# cd /usr/local/src/tarbag/  
  2. [root@ www.bkjia.com tarbag]# wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz  
  3. [root@ www.bkjia.com tarbag]# wget http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.25.tar.gz  
  4.  
  5. [root@ www.bkjia.com tarbag]# tar -zxvpf cmake-2.8.4.tar.gz -C ../software/  
  6. [root@ www.bkjia.com tarbag]# tar -zxvpf mysql-5.5.25.tar.gz -C ../software/  
  7. [root@ www.bkjia.com tarbag]# cd ../software/cmake-2.8.4/  
  8. [root@ www.bkjia.com cmake-2.8.4]# ./configure --prefix=/usr/local/cmake2.8.4 && make && make install  
  9.  
  10. [root@ www.bkjia.com ~]# grep PATH .bash_profile   
  11. PATH=$PATH:$HOME/bin:/usr/local/cmake2.8.4/bin:$PATH  
  12. export PATH  
  13. [root@ www.bkjia.com ~]# . .bash_profile   
  14.  
  15. [root@ www.bkjia.com ~]# cd /usr/local/src/software/mysql-5.5.25/  
  16. [root@ www.bkjia.com mysql-5.5.25]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.5.25 \  
  17. -DMYSQL_DATADIR=/mydata \  
  18. -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \  
  19. -DWITH_INNOBASE_STORAGE_ENGINE=1 \  
  20. -DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all \  
  21. -DDEFAULT_CHARSET=utf8 \  
  22. -DDEFAULT_COLLATION=utf8_general_ci \  
  23. -DWITH_DEBUG=0 
  24.  
  25. [root@ www.bkjia.com mysql-5.5.25]# make && make install 

3. initialize the mysql service.

 
 
  1. [root@ www.bkjia.com mysql-5.5.25]# cp support-files/my-large.cnf /etc/my.cnf   
  2. [root@ www.bkjia.com mysql-5.5.25]# cp support-files/mysql.server /etc/init.d/mysqld   
  3. [root@ www.bkjia.com mysql-5.5.25]# chmod +x /etc/init.d/mysqld   
  4. [root@ www.bkjia.com mysql-5.5.25]# chkconfig --add mysqld  
  5.  
  6. [root@ www.bkjia.com mysql-5.5.25]# sh ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql5.5.25/ --datadir=/mydata/  
  7.  
  8. [root@ www.bkjia.com mysql-5.5.25]# service mysqld start  
  9. Starting MySQL...[  OK  ]  
  10.  
  11. [root@ www.bkjia.com ~]# echo '/usr/local/mysql5.5.25/include/' >> /etc/ld.so.conf  
  12. [root@ www.bkjia.com ~]# echo '/usr/local/mysql5.5.25/lib/' >> /etc/ld.so.conf  
  13. [root@ www.bkjia.com ~]# ldconfig  
  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.