The official MySQL 5.6 version has been released. Compared with MySQL 5.5, the source code installation and configuration methods have also changed. Based on actual operations, this article continuously attempts to precisely restore the installation steps.
Environment: Minimize the default installation of CentOS 6.3/6.4 and configure the NIC.
Before installing MySQL, check that the Internet connection is normal to download the installation file.
Use the yum-y update command to upgrade the system to the latest version.
This installation separates the MySQL data file from the execution file. If you want to set a different path, modify the corresponding execution command and database initialization script.
# Modify firewall settings and open port 3306
Vi/etc/sysconfig/iptables
-A input-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT
# Restart the firewall to make the new settings take effect
Service iptables restart
# New User Group
Groupadd mysql
# Add a user
Useradd mysql-g mysql
# Create a database execution file directory
Mkdir-p/usr/local/mysql
# Creating a database data file directory
Mkdir-p/db/mysql/data
# Edit PATH search PATH
Vi/etc/profile
Append these 2 lines to the end of the file:
PATH =/usr/local/mysql/bin:/usr/local/mysql/lib: $ PATH
Export PATH
# Effective PATH search PATH
Source/etc/profile
# Edit the hosts file and add the local IP address and Host Name
Vi/etc/hosts
192.168.211.100 centhost. centdomain
# Install the tools and libraries required for compiling source code
Yum-y install wget gcc-c ++ ncurses-devel cmake make perl
# Go To The Source Code compressed package download directory
Cd/usr/local/src
# Download the source code compressed package. The size of the downloaded package is 34 MB, which is a bit slow. Wait.
Wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz/from/http://cdn.mysql.com/
# Decompress the source code package
Tar-zxvf mysql-5.6.10.tar.gz
# Enter the decompressed source code directory
Cd mysql-5.6.10
# From mysql5.5, mysql source code Installation started using cmake and executed the source code compilation and configuration script.
Cmake \
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
-DMYSQL_UNIX_ADDR =/usr/local/mysql. sock \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE = 1 \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_ARCHIVE_STORAGE_ENGINE = 1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \
-DWITH_MEMORY_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DENABLED_LOCAL_INFILE = 1 \
-DMYSQL_DATADIR =/db/mysql/data \
-DMYSQL_USER = mysql \
-DMYSQL_TCP_PORT = 3306