CentOS 6.4 Compile and install MySQL 5.6.14 reference: http://www.cnblogs.com/xiongpq/p/3384681.html Overview:
In CentOS 6.4, the installation of MySQL via Yum is version 5.1, older, so you want to install the high version of 5.6.14 via source code.
Text: One: Uninstall the old version
Use the following command to check if MySQL Server is installed
Rpm-qa | grep MySQL
Some words are unloaded by the following command
RPM-E MySQL //normal Delete mode rpm-e--nodeps mysql //brute force Delete mode, if you use the above command to delete, prompted to have other dependent files, then use this command can be strongly deleted
Two: Install MySQL install the package required for compiling code
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel
Download MySQL 5.6.10
wget wget HTTP://DEV.MYSQL.COM/GET/DOWNLOADS/MYSQL-5.6/MYSQL-5.6.10.TAR.GZTAR-ZXVF MYSQL-5.6.10.TAR.GZCD mysql-5.6.10
Compiling the installation
CMake \
-DCMAKE_INSTALL_PREFIX=/OPT/APP/MYSQL5 \
-dmysql_unix_addr=/opt/app/mysql5/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=/opt/app/mysql5/data \
-dmysql_user=mysql \
-dmysql_tcp_port=3306make && make Install
The compiled parameters can be referenced
Http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html.
http://blog.csdn.net/lyd518/article/details/20284379
The whole process takes about 30 minutes ... A long wait
Three: Configure MySQL settings permissions
Use the following command to see if there are MySQL users and user groups
CAT/ETC/PASSWD View user list Cat/etc/group View user Groups list
If not, create
Groupadd mysqluseradd-g MySQL MySQL
Modify/usr/local/mysql Permissions
Chown-r MYSQL:MYSQL/OPT/APP/MYSQL5
Modify directory Owner (/OPT/APP/MYSQL5) permissions
Chown-r MYSQL:MYSQL/OPT/APP/MYSQL5
Chown-r Mysql:mysql/opt/app/mysql5/data
Initialize configuration
Go to installation path
Cd/usr/local/mysql
Enter the installation path, execute the initialization configuration script, create the system's own database and table
scripts/mysql_install_db--BASEDIR=/OPT/APP/MYSQL5--datadir=/opt/app/mysql5/data--user=mysql
Initialization script generates a configuration file in/opt/app/mysql5/my.cnf
Note: When starting the MySQL service, will be in a certain order to search my.cnf, first in the/etc directory, find will search "$basedir/my.cnf", in this case is/opt/app/mysql5/ MY.CNF, this is the default location for the new MySQL configuration file! Note: After the minimum installation of the CentOS 6.4 operating system is complete, there will be a my.cnf in the/etc directory, you need to rename this file to another name, such as:/etc/my.cnf.bak, otherwise, the file will interfere with the correct configuration of the source installed MySQL, Causing the failure to start.
Start MySQL
Add services, Copy service scripts to the INIT.D directory, and set boot boot
CP support-files/mysql.server/etc/init.d/mysqlchkconfig MySQL onservice mysql start --Start MySQL
Configure users
After MySQL starts successfully, Root does not have a password, we need to set the root password.
Before setting, we need to set path, or we can't call MySQL directly
Modify the/etc/profile file to add at the end of the file
Path=/opt/app/mysql5/bin: $PATHexport PATH
Close the file, run the following command, and let the configuration take effect immediately
Source/etc/profile
Now, we can enter MySQL in the terminal directly into the MySQL environment
Execute the following command to modify the root password
Mysql-uroot mysql> SET PASSWORD = PASSWORD (' 123456 ');
To set the root user to have remote access, perform
Mysql> GRANT All privileges on * * to ' root ' @ ' 172.16.% ' identified by 'password ' with GRANT OPTION;
When the red password is remote access, the root user's password can be different from the local.
Configuring firewalls
Firewall 3306 port is not enabled by default, to remote access, you need to open this port
Open/etc/sysconfig/iptables
Under "-A input–m State--state new–m tcp–p–dport 22–j ACCEPT", add:
-A input-m state--state new-m tcp-p-dport 3306-j ACCEPT
Then save and close the file, run the following command in the terminal and refresh the firewall configuration:
Service Iptables Restart
OK, all configured, you can access your MySQL ~
mysql cmake compilation parameters-dcmake_install_prefix= point to the Mysql installation directory-dinstall_sbindir=sbin point to the executable directory (prefix/ Sbin)-dmysql_datadir=/var/lib/mysql point to the MySQL data file directory (/var/lib/mysql)-dsysconfdir=/etc/mysql point to the MySQL profile directory (/etc/ MySQL)-dinstall_plugindir=lib/mysql/plugin point to the plug-in directory (Prefix/lib/mysql/plugin)-dinstall_mandir=share/man Point to the Man document directory (Prefix/share/man)-dinstall_sharedir=share point to ACLOCAL/MYSQL.M4 installation directory (Prefix/share)-dinstall_libdir=lib/ MySQL points to the object code base directory (Prefix/lib/mysql)-dinstall_includedir=include/mysql points to the header file directory (prefix/include/mysql)-dinstall_ Infodir=share/info point to Info document storage directory (prefix/share/info) prefix official recommendation set to/usrstorage engine related type Csv,myisam,myisammrg,heap, Innobase,archive,blackhole to enable support for an engine:-dwith_<engine>_storage_engine=1 such as:-dwith_innobase_storage_engine=1 -dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1 If you want to disable support for an engine:-dwithout_<engine>_storage_ Engine=1 such as:-dwithout_example_storage_engine=1-dwithout_federated_storage_engine=1-dwithout_partition_storage_ Engine=1library related-dwith_readline=1Enable ReadLine Library Support (provides editable command line)-dwith_ssl=system Enable SSL Library support (Secure Sockets Layer)-dwith_zlib=system enable LIBZ Library Support (Zib, Gzib related)-dwtih_libwrap= 0 Disabling the LibWrap library (which implements the functionality of the generic TCP wrapper for use by the Network Service daemon)-dmysql_tcp_port=3306 specifies that the TCP port is 3306-dmysql_unix_addr=/tmp/mysqld.sock Specify Mysql.sock path-denabled_local_infile=1 enable local data import support-dextra_charsets=all enable additional character set types (default to All)-ddefault_charset=utf8 Specifies that the default character set sets the default collation for Utf8-ddefault_collation=utf8_general_ci (utf8_general_ci Fast/utf8_unicode_ci accurate)-dwith_embedded_ Server=1 compile embedded Server support-dmysql_user=mysql specify MySQL user (default is MySQL)-dwith_debug=0 disable DEBUG (default is disabled)-denable_profiling=0 Disable profiling analysis (default is on)-dwith_comment= ' string ' A descriptive comment reference for the compilation environment (Http://blog.sina.com.cn/s/blog_ 68c25adf0101402v.html)
Compile and install mysql5.6 under CentOS