The Installation Method of MySQL 5.5 is slightly different from that of MySQL 5.1. The main difference lies in the configuration environment. For the installation method of MySQL 5.1, refer to build the LAMP environment (source code method ). This article explains how to install MySQL 6.1 on RedHat 5.5.
First of all, we need to prepare MySQL. As for where to download it, we don't need to talk about it. It's hard to be a smart friend. The MySQL version used in this article is 5.5.29. If the reader has prepared the version or other versions of MySQL 5.5, the following describes how to install MySQL 5.5. All operations in this article are completed under the virtual machine.
Recommended reading:
Complete MySQL installation and master-slave dual-machine configuration
Install MySQL database in rpm mode on RHEL6 Platform
RedHat 6.3 MySQL-server-5.6.13-1.el6.x86_64.rpm Installation
Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04
Step 1: copy the MySQL 5.5 source code package to the Virtual Machine
[root@serv01 ~]# yum install /usr/bin/scp -y[root@larrywen ule-mysql]# scpmysql-5.5.29.tar.gz 192.168.1.11:/optroot@192.168.1.11's password:mysql-5.5.29.tar.gz 100% 24MB 23.7MB/s 00:00
Step 2: make and other commands are required to compile the source code. Therefore, we need to install the development kit.
[root@serv01 ~]# yum grouplist | grep Devel Additional Development Desktop Platform Development Development tools Server Platform Development[root@serv01 ~]# yum groupinstall"Development tools" -y
Step 3: Decompress the source code package to the/usr/src directory./usr/src is the recommended command.
[root@serv01 opt]# tar -xvf mysql-5.5.29.tar.gz -C /usr/src/
Step 4: Enter the MySQL decompression directory
[Root @ serv01 opt] # cd/usr/src/mysql-5.5.29/# installation help documentation (refer to this file for installation) [root @ serv01 mysql-5.5.29] # vim INSTALL-SOURCEshell> tar zxvf mysql-VERSION.tar.gzshell> cd mysql-VERSIONshell> cmake. shell> makeshell> make install # End of source-build specific instructions # Postinstallation setupshell> cd/usr/local/mysqlshell> chown-R mysql. shell> chgrp-R mysql. shell> scripts/mysql_install_db -- user = mysqlshell> chown-R root. shell & gt; chown-R mysql data # Next command is optionalshell & gt; cp support-files/my-medium.cnf/etc/my. cnfshell> bin/mysqld_safe -- user = mysql & # Next command is optionalshell> cp support-files/mysql. server/etc/init. d/mysql. server
Step 5: Because the configuration environment requires cmake and MySQL depends on the ncurses-devel package, we install cmake and ncurses-devel
[root@serv01 mysql-5.5.29]# yum install cmake-y[root@serv01 mysql-5.5.29]# yum install ncurses-devel -y
Step 6: key steps. This step is also different from MySQL 5.1. Use the cmake command to configure the environment, as shown below:
[Root @ serv01 mysql-5.5.29] # cmake. \-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \-Internal = 1 \-Internal = 1 \-Internal = 1 \-DDEFAULT_CHARSET = utf8 \-DDEFAULT_COLLATION = utf8_general_ci \-Internal = all -DMYSQL_TCP_PORT = 3306 \-DMYSQL_UNIX_ADDR =/tmp/mysql. sock \-DMYSQL_DATADIR =/usr/local/mysql/data explanation:-DCMAKE_INSTALL_PREFIX =/usr/local/mysql: MySQL installation directory. We recommend that you install it in this directory-DWITH_INNOBASE_STORAGE_ENGINE = 1: install InnoDB Storage engine-DWITH_MYISAM_STORAGE_ENGINE = 1: Install MyISAM storage engine-DWITH_MEMORY_STORAGE_ENGINE = 1: install memory storage engine-DDEFAULT_CHARSET = utf8: default encoding set to utf8-DDEFAULT_COLLATION = utf8_general_ci: the silent validation rule is utf8_general_ci-DWITH_EXTRA_CHARSETS = all: supports all other encodings-DMYSQL_TCP_PORT = 3306: MySQL port is specified as 3306-DMYSQL_UNIX_ADDR =/tmp/mysql. sock: Specify the SOCK file path-DMYSQL_DATADIR =/usr/local/mysql/data: MySQL data DIRECTORY
For more details, please continue to read the highlights on the next page: