This tutorial mainly explains how to compile and install MySQL 5.6.14 under CentOS 6.5!
1. Uninstall the old version:
Use the following command to check if MySQL server is installed
- <span style="font-family:'Microsoft YaHei';font-size:16px;">[root@localhost ~]# rpm -qa | grep mysql
- mysql-libs-5.1.73-7.el6.x86_64</span>
Uninstall it if any using the command below
- <span style="font-family:'Microsoft YaHei';font-size:16px;">rpm -e --nodeps mysql_libs</span>
2. Install MySQL:
- <span style= "font-family:'Microsoft YaHei';font-size:16px;">Install the packages needed to compile the code
- yum -y install make gcc-c++www.006665.cn cmake bison-devel ncurses-devel
- Unzip the MySQL package
- tar -zxvf mysql-5.6.14.tar.gz
- cd mysql-5.6.14
- Compile and install
- cmake -DCMAKE_INSTALL_PREFIX=/usr/local /www.wanmeiyuele.cn mysql -DMYSQL_DATADIR=/usr/local/mysql/data -
- DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_INNOBASE_STORAGE_ENGINE=1-
- DWITH_MEMORY_STORAGE_ENGINE=1-DWITH_READLINE=1-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -
- DMYSQL_TCP_www.baohuayule.com PORT=3306-DENABLED_LOCAL_INFILE=1-DWITH_PARTITION_STORAGE_ENGINE=1-
- DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
- compile and install
- make && make install</span>
The process is a little long, please be patient. . .
3. Configure MySQL:
Create MySQL groups and accounts
- <span style="font-family:'Microsoft YaHei';font-size:16px;">groupadd mysql
- useradd -g mysql mysql</span>
edit permission:
- <span style="font-family:'Microsoft YaHei';font-size:16px;">chown -R mysql:mysql /usr/local/mysql</span>
Initialize the configuration, enter the installation path (execute the following instructions), execute the initialization configuration script, and create the database and tables that come with the system
- <span style="font-family:'Microsoft YaHei';font-size:16px;">cd /usr/local/mysql
- scripts/mysql_install_db --basedir=/www.leyou1178.cn usr/local/mysql--datadir=/usr/local/mysql/data --user=mysql</span>
We will use the configuration file /usr/local/mysql/my.cnf in the future. In order to prevent interference, we will rename my.cnf under etc.
- <span style="font-family:'Microsoft YaHei';font-size:16px;">mv /etc/my.cnf /etc/my.cnf.bak</span>
4. Start MySQL
Add a service, copy the service script to the init.d directory, and set it to start on boot
- <span style= "font-family:'Microsoft YaHei';font-size:16px;"> Execute under /usr/local/mysql
- cp support-files/mysql.server /etc/init.d/mysql
- chkconfig mysql on
- service mysql start --start MySQL</span>
start mysql client
- <span style="font-family:'Microsoft YaHei';font-size:16px;">cd /usr/local/mysql/bin
- ./mysql -uroot -p www.baohuayule.cn </span>
The entire MySQL configuration is completed, I wish you a happy use~