Get ready:
Download MySQL source file package: https://edelivery.oracle.com/to register login to find the required source package for download.
Yum Remove *mysql*/-name mysql --delete old files directory
To create a user:
Groupadd mysql1 -G MYSQL1 mysql1 --Create MYSQL1 user passwd mysql1
To install a dependency package:
Cp-r mysql-5.6. /home/-R mysql1:mysql1/home/mysql1yum install make gcc-c++ cmake Bison ncurses Ncurses-devel
Installation:
Su-MYSQL1CD/home/mysql1/mysql-5.6. -CMake-dcmake_install_prefix=/home/mysql1/mysql \--installation directory-dmysql_datadir=/home/mysql1/mysql/data \--Catalog Files-dsysconfdir=/home/mysql1/mysql\--configuration file-dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_memory_storage_engine=1 -dwith_readline=1 -dmysql_unix_addr=/home/mysql1/mysql/mysql.sock \--Sock file path-dmysql_tcp_port=3306\ --Port-denabled_local_infile=1 -dwith_partition_storage_engine=1 -dextra_charsets= All-ddefault_charset=utf8 \--character encoding-ddefault_collation=utf8_general_ci--Enter to wait for CMake to complete
Make && make install
To configure environment variables:
vi. bash_profileexport mysql_home=/home/mysql1/mysqlexport PATH= $MYSQL _home/bin: $PATH
编辑/home/mysql1/mysql/my.cnf参数文件:
[mysqld]# Remove leading # andSetTo the amount of RAM forThe most important data# cacheinchMysql. Start at -% of Total RAM forDedicated server,Else Ten%. Innodb_buffer_pool_size=128M # Remove Leading # to turn in a very important data integrity option:logging# changes to the binary log between backups.# Log_bin # These is commonlySet, remove the # andSet asRequired.basedir=/home/mysql1/Mysqldatadir=/home/mysql1/mysql/dataport=3306server_id=1Socket=/home/mysql1/mysql/Mysql.sockpid-file =/home/mysql1/mysql/mysql.pid #long_query_time=1#log-slow-queries =/home/mysql1/mysql/mysql-Slow.log # Remove Leading # toSetOptions mainly useful forreporting servers.# The server defaults is faster fortransactions and fast selects.# Adjust sizes asneeded, experiment to find the optimal values.join_buffer_size=128msort_buffer_size=2mread_rnd_buffer_size=2M Sql_mode=no_engine_substitution,strict_trans_tables
保存退出;
Registration Service:
cp/home/mysql1/mysql/support/mysql.server/etc/rc.d/init.d/--add mysql1service mysql1 start
Initialize the database:
scripts/mysql_install_db--basedir=/home/mysql1/mysql--datadir=/home/mysql1/mysql/data--USER=MYSQL1-- User Login for System
To change the root initial password:
' MYSQL1 '
Login:
Mysql-uroot-p --Log in
[Install second MySQL on the same server]
Groupadd Mysql2useradd-g Mysql2 MYSQL2CP-R mysql-5.6. -/home/Mysql2cmake-dcmake_install_prefix=/home/mysql2/MySQL-dmysql_datadir=/home/mysql2/mysql/Data-dsysconfdir=/home/mysql2/MySQL-dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_memory_storage_engine=1 -dwith_readline=1 -dmysql_unix_addr=/home/mysql2/mysql/Mysql.sock-dmysql_tcp_port=3307 -denabled_local_infile=1 -dwith_partition_storage_engine=1 -dextra_charsets= All-ddefault_charset=UTF8-ddefault_collation=Utf8_general_ci Make&& make Install
vi. bash_profileexport mysql_home=/home/mysql2/mysqlexport PATH= $MYSQL _home/bin: $PATH
编辑/home/mysql1/mysql/my.cnf
[MYSQLD] # Remove leading # andSetTo the amount of RAM forThe most important data# cacheinchMysql. Start at -% of Total RAM forDedicated server,Else Ten%. Innodb_buffer_pool_size=128M # Remove Leading # to turn in a very important data integrity option:logging# changes to the binary log between backups.# Log_bin # These is commonlySet, remove the # andSet asRequired.basedir=/home/mysql2/Mysqldatadir=/home/mysql2/mysql/dataport=3307server_id=2Socket=/home/mysql2/mysql/Mysql.sockpid-file =/home/mysql2/mysql/mysql.pid #long_query_time=1# Remove Leading # toSetOptions mainly useful forreporting servers.# The server defaults is faster fortransactions and fast selects.# Adjust sizes asneeded, experiment to find the optimal values.join_buffer_size=128msort_buffer_size=2mread_rnd_buffer_size=2M Sql_mode=no_engine_substitution,strict_trans_tables
保存退出;
cp/home/mysql2/mysql/support/mysql.server/etc/rc.d/init.d/--add Mysql2service mysql2 start/home/ Mysql2/mysql/scripts/mysql_install_db--basedir=/home/mysql2/mysql--datadir=/home/mysql2/mysql/data--user= mysql2--'mysql2'-uroot-p --Login
redhat6.4 Source Installation mysql5.6