The latest mysql versions require cmake compilation and installation. It is estimated that this method will be used in future versions. Therefore, we will record the installation steps and procedures for your reference.
Note: This installation is the default CentOS has installed the latest toolkit, such as GNU make, GCC, Perl, libncurses5-dev, if there is a missing toolkit found during the compilation and installation process, first, download and install yum install separately before continuing.
The following installation involves several issues that need to be explained in advance:
1. All downloaded files will be saved in the/usr/local/src/directory.
2. mysql will run as a mysql user, and will automatically run after the service is started.
3. mysql will be installed in the/usr/local/mysql/directory.
4. mysql uses the utf8 character set by default.
5. mysql data and log files are stored in the/data/mysql/directory.
6. Save the mysql configuration file to/etc/my. cnf.
1. Use wget to download the required software from Centos and save it to the/usr/local/src/directory.
Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.22.tar.gz/from/http://mysql.he.net/
Wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz
Wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
Ii. Install cmake
Cd/usr/local/src
Tar zxvf cmake-2.8.7.tar.gz
Cd cmake-2.8.7
./Bootstrap
Gmake
Gmake install
Cd ../
Tar zxvf bison-2.5.tar.gz
Cd bison-2.5
./Configure
Make
Make install
Cd ../
Iii. Compile and install MySQL 5.5.22
/Usr/sbin/groupadd mysql
/Usr/sbin/useradd-g mysql
Tar xzvf mysql-5.5.22.tar.gz
Cd mysql-5.5.22/
Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_UNIX_ADDR =/var/lib/mysql. sock-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-rows = all-rows = 1-rows = 1-rows = 1-DWITH_READLINE = 1-rows = 1-DMYSQL_DATADIR =/data/mysql -DMYSQL_USER = mysql
Make
Make install
Chmod + w/usr/local/mysql
Chown-R mysql: mysql/usr/local/mysql
Ln-s/usr/local/mysql/lib/libmysqlclient. so.16/usr/lib/libmysqlclient. so.16
Mkdir-p/var/mysql/
Mkdir-p/var/mysql/data/
Mkdir-p/var/mysql/log/
Chown-R mysql: mysql/var/mysql/
Cd support-files/
Cp my-large.cnf/etc/my. cnf (Note: my-large.cnf is suitable for servers around 1g memory, you can choose according to your own configuration of my-large.cnf or my-huge.cnf and other different configurations)
Cp mysql. server/etc/init. d/mysqld
4. Configure to start MySQL 5.5.22
1. If necessary, first modify mysql configuration my. cnf
Vi/etc/my. cnf
2. mysql initialization and Installation
/Usr/local/mysql/scripts/mysql_install_db \
-- Defaults-file =/var/mysql/my. cnf \
-- Basedir =/usr/local/mysql \
-- Datadir =/var/mysql/data \
-- User = mysql
3. Add mysql to start up
Chmod + x/etc/init. d/mysqld
Vi/etc/init. d/mysqld (edit this file, find and modify the following variable content :)
Basedir =/usr/local/mysql
Datadir =/var/mysql/data
Chkconfig -- add mysqld
Chkconfig -- level 345 mysqld on
4. Start mysql
Service mysqld start