First, Mysql5.6.10 installation
1.1. Necessary software
Yum-y install gcc gcc-c++ autoconf automake bison ncurses-devel libtool-ltdl-devel* cmake make
1.2. Compile and install
[[email protected] src] #groupadd mysql
[[email protected] src]# useradd mysql-g MySQL
[Email protected] src]# pwd
/usr/local/src
[[email protected] src] #mkdir/home/mysql/data-p
[Email protected] src]# Mkdir/usr/local/mysql
[[email protected] src]# ls
Mysql-5.6.10.tar.gz
Cm/pwd[[email protected] src]# tar-zvxf mysql-5.6.10.tar.gz
CMake software can be compiled or installed without compiling the installation is not currently found to not compile the installation what is the problem
RPM Package CMake in CentOS version is 2.6.4-5. El6 as to why the compilation installation CMake I personally think is because in the rhel5 is not or the version is too low some MySQL installation or on the RHEL5 on the official network of CMake is also the two versions 2.6.4 is always downloaded
Download cmake-2.8.10.2 version
[Email protected] src]# TAR-ZVXF cmake-2.8.10.2.tar.gz
[Email protected] src]# CD cmake-2.8.10.2
[Email protected] cmake-2.8.10.2]#./bootstrap
[[email protected] cmake-2.8.12.1] #make &&make Install
[Email protected] cmake-2.8.12.1]# CMake--help |head-n1
CMake version 2.8.12.1
[Email protected] cmake-2.8.12.1]# Cd/usr/local/src/mysql-5.6.10/storage
What storage engine support can be seen in a directory
[[email protected] storage]# ls
Archive CSV Federated Innobase MYISAMMRG Perfschema
blackhole Example Heap MyISAM NDB
[Email protected] storage]# pwd
/usr/local/src/mysql-5.6.10/storage
[Email protected] storage]# cd/usr/local/src/mysql-5.6.10
[[email protected] mysql-5.6.10] #cmake-dcmake_install_prefix=/usr/local/mysql \
-dmysql_unix_addr=/tmp/mysql.sock \
-dmysql_datadir=/data/mysql/data/\
-DSYSCONFDIR=/ETC \
-dwith_tcp_port=3306 \
-dmysql_user=mysql \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dwith_extra_charsets:string=all \
-denabled_local_infile=1 \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1
Parameter configuration detailed Explanation:
In fact, the 5.6 version can be all the parameters about the engine is not filled out because the default is all to install
And 5.5 is different about-dwith_archive_storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwith_federated_storage_engine=1 \ These three are must be filled out by themselves otherwise, only 6 engines can be compiled;
#/*-dwith_readline=1 # shortcut key function
#/*-dmysql_unix_addr=/usr/local/mysql/mysqld.sock # Connection Database socket path
#/*-dmysql_tcp_port=3306 # Port
#/*-denabled_local_infile=1 # Allow importing data from local
[[email protected] src] #make && make install
[[email protected] src] #cd/usr/local/mysql/scripts/
[Email protected]]#./mysql_install_db--user=mysql--datadir=/data/mysql/data--basedir=/usr/local/mysql
[[email protected] src] #cd/usr/local/mysql/support-files/
[[email protected] src] #cp mysql.server/etc/init.d/mysqld
[[email protected] src] #chmod 755/etc/init.d/mysqld
[[email protected] src] #cat >>/etc/profile <<eof
Export path= $PATH:/usr/local/mysql/bin
Eof
[[email protected] src] #source/etc/profile
[[email protected] src] #cd/usr/local/mysql/support-files/
[[email protected] support-files] #cp-F MY-DEFAULT.CNF/ETC/MY.CNF
[[email protected] support-files] #cat >>/etc/my.cnf <<eof
Sql_mode=no_engine_substitution,strict_trans_tables
Log-bin=mysql-bin
Server_id=1
expire_logs_days=10
Binlog_format=mixed
table_definition_cache=10000
max_connections=5000
key_buffer_size=2g
tmp_table_size=2g
read_buffer_size=4m
read_rnd_buffer_size=16m
sort_buffer_size=4m
Join_buffer_size = 8M
Thread_cache_size=64
wait_timeout=1800
query_cache_size=64m
innodb_buffer_pool_size=32g
innodb_additional_mem_pool_size=200m
innodb_sort_buffer_size=4m
innodb_log_buffer_size=4m
Innodb_thread_concurrency=0
#innodb_data_file_path = Ibdata1:1g:autoextend
Innodb_flush_log_at_trx_commit = 2
Innodb_status_file = 1
Open_files_limit = 60000
innodb_open_files=60000
long_query_time=0.1
Slow_query_log=1
Slow_query_log_file=/home/mysql/data/slow-query.log
[[email protected] support-files] #chown mysql.mysql/etc/my.cnf
changing system parameters
Vi/etc/security/limits.conf
* Soft Nofile 65535
* Hard Nofile 65535
* Soft Nproc 65535
* Hard Nproc 65535
# To change the installation directory owner to mysql[above changes, and here to become the root owner, so you can choose to change to MySQL]
[[email protected] support-files] #chkconfig--add mysqld
[[email protected] support-files] #chkconfig mysqld on
[[email protected] support-files]# chkconfig--list |grep MySQL--234 must be on
[[email protected] support-files] #service mysqld start
[[Email protected]client100 support-files] #echo "drop user ' root ':: 1 ';d ROP user ' @ ' localhost ';d rop user ' root ' @ ' Localhost.localdomain '; ' | Mysql
[[email protected] support-files] #mysqladmin-u root password ' haowu123 '
--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
If the database error is mostly two possible
The first is you [[email protected]]#./mysql_install_db--user=mysql--datadir=/data/mysql/data--basedir=/usr/local/ MySQL path is not correct then re-execute this sentence
The second is that you have an old database that has not been shut down or you have multiple service mysqld start caused. The solution is as follows
[Email protected] support-files]# service mysqld restart
error! MySQL server PID file could not being found!
Starting MySQL. error! The server quit without updating PID file (/data/mysql/data/localhost.localdomain.pid).
[[email protected] support-files]# ps-ef |grep MySQL
Root 47388 1 0 17:03 pts/0 00:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/data/mysql/data--pid- File=/data/mysql/data/localhost.localdomain.pid
MySQL 47503 47388 0 17:03 pts/0 00:00:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/data/mys Ql/data--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=/data/mysql/data/ Localhost.localdomain.err--pid-file=/data/mysql/data/localhost.localdomain.pid
Root 62679 11100 0 22:06 pts/0 00:00:00 grep mysql
[Email protected] support-files]# kill-9 47503
[Email protected] support-files]# service mysqld restart
error! MySQL server PID file could not being found!
Starting MySQL. success!
--------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
Ii. MYSQL5.5.34 Compile and install
Mysql5.5.34 installation steps and the above basic consistent compilation of the place need to compile the full point of the other template replication is also slightly different
[[email protected] mysql-5.6.10] #cmake-dcmake_install_prefix=/usr/local/mysql \
-dmysql_unix_addr=/tmp/mysql.sock \
-dmysql_datadir=/data/mysql/data/\
-DSYSCONFDIR=/ETC \
-dwith_tcp_port=3306 \
-dmysql_user=mysql \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dwith_extra_charsets:string=all \
-denabled_local_infile=1 \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-dwith_archive_storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwith_federated_storage_engine=1
[email protected] support-files]# CP my-medium.cnf/etc/my.cnf
Vim/etc/my.cnf
Add the above parameters to the change parameters that exist in the mysqld
The archive:archive storage engine is used for non-indexed, very small coverage of large amounts of data stored
Blackhole: The storage engine accepts but does not store data, and the retrieval always returns an empty set but is recorded in the log.
Federated: The storage engine has the data in the remote database
InnoDB and Bdb:innodb and BDB storage engines provide transaction-safe tables
The Memory:memory storage Engine provides an "in-memory" table, and the memory storage engine is formally identified as the heap engine.
Myisam:myisam Manage non-transactional tables. It provides high-speed storage and retrieval, as well as full-text search capabilities.
The Example:example storage engine is a "stub" engine that does nothing.
NDB Cluster: Is the storage engine used by MySQL Cluster to implement tables that are partitioned into multiple computers. It is available in the Mysql-max 5.1 binary distribution. This storage engine is currently supported only by Linux, Solaris, and Mac OS X.
CSV: The storage engine stores data in a comma-delimited format in a text file.
MERGE: The storage engine allows the collection to be processed by the same MyISAM table as a separate table. Like MyISAM, the memory and merge storage engines handle non-transactional tables, both of which are included by default in MySQL. Equivalent to Mrg_myisam in 5.6
Finally, if your storage engine is less installed or more installed, you can install or uninstall
1, check that MySQL configuration is not supported dynamically add plugins
Mysql> Show variables like "have_%";
+----------------------+-------+
| variable_name | Value |
+----------------------+-------+
| have_compress | YES |
| Have_crypt | YES |
| Have_csv | YES |
| have_dynamic_loading | YES | Here is the Yes expression is supported
If it is no, it is not very good, because have_dynamic_loading is a read-only variable,
Mysql> set have_dynamic_loading=1;
mysql> Install plugin INNODB soname "ha_innodb.so";
mysql> Install plugin Innodb_trx soname "ha_innodb.so";
mysql> Install plugin innodb_locks soname "ha_innodb.so";
mysql> Install plugin innodb_lock_waits soname "ha_innodb.so";
mysql> Install plugin innodb_cmp soname "ha_innodb.so";
mysql> Install plugin innodb_cmp_reset soname "ha_innodb.so";
mysql> Install plugin innodb_cmpmem soname "ha_innodb.so";
mysql> Install plugin innodb_cmpmem_reset soname "ha_innodb.so"
mysql> Install plugin ARCHIVE soname "ha_archive.so";
After installation, use show engines; or show plugins; to see
)
2: Build a double master
(1): Modify the 2-side profile after MySQL is installed on 2 servers
Vi/etc/my.cnf
Master1 Turn on log mode: Log_bin=mysql_bin
Server_id=1
Master2 Turn on log mode: Log_bin=mysql_log
server_id=2
Log into mysql:mysql–phaowu123 on Master1
Authorization: Grant replication Slave on * * to [e-mail protected] '% ' identified by ' [email protected] ';
Refresh authorization: Flush privileges;
(2): Master1 on show master status; View Master Status
Reset Master;
Test authorization success with slave user login Master1 on Master2
Mysql–u–p–h
Log into MySQL on master2 to do changer master to (note; stop slave;)
Change MASTER to
Master_host= ',
Master_user= ',
Master_password= ',
master_port=3306,
Master_log_file= ',
master_log_pos=
master_connect_retry=10;
Start slave;
Show Slave Status\g
See:
Slave_io_running:yes
Slave_sql_running:yes Instructions OK
(3): 2 The same way
To this MySQL mutual master from the building completed
CENTOS6.5 Install mysql5.6 and build a dual master