CentOS6.3Minimal source code installation MySQL5.6.10 CentOS
BitsCN.com
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: CentOS 6.3 minimizes the default installation and configures 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
# Compile the source code. this step will take a long time and be patient.
Make
# Installation
Make install
# Clear temporary installation files
Make clean
# Modifying directory owner
Chown-R mysql: mysql/usr/local/mysql
Chown-R mysql: mysql/db/mysql/data
# Enter the installation path
Cd/usr/local/mysql
# Execute the initialization configuration script to create the database and table that comes with the system.
Scripts/mysql_install_db -- user = mysql -- datadir =/db/mysql/data
The initialization script generates a configuration file in/usr/local/mysql/my. cnf. You need to change the owner of the configuration file:
Chown-R mysql: mysql/usr/local/mysql
When starting the MySQL service, I will search for my in a certain order. cnf, which is first found in the/etc directory. If no cnf is found, "$ basedir/my. cnf ", in this example/usr/local/mysql/my. cnf, which is the default location of the new MySQL configuration file!
# Copy the service startup script
Cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysql
# Start the MySQL service
Service mysql start
# Set automatic start of service upon startup
Chkconfig mysql on
# Run the security settings script to modify the MySQL User root (not the system root !) Password, prohibit root remote connection (prevent password cracking), remove the test database and anonymous users, it is strongly recommended that the production server use:
/Usr/local/mysql/bin/mysql_secure_installation
>>>>>>>>>>>>>> Complete
BitsCN.com