Install mysql5.6 source code and mysql5.6 source code
1. Environment Introduction:
Pack: mysql-5.6.24.tar.gz
Platform: centos6.5
2. Install the cmake compilation tool and dependency package:
yum install cmake -yyum install ncurses -yyum install bison -yyum install gcc-c++ -yyum install gcc -y
3. Create a mysql user:
useradd mysql -s /sbin/nologin
4. Install and compile mysql
A. Go to the mysql installation directory.
B. cmake Compilation:
Cmake. -DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_DATADIR =/var/lib/mysql-DSYSCONFDIR =/etc-region = 1-region = 1-region = 1-DWITH_PARTITION_STORAGE_ENGINE = 1- DMYSQL_UNIX_ADDR =/tmp/mysqld. sock-nodes = 1-DEXTRA_CHARSETS = all-DMYSQL_USER = mysql-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DWITH_EMBEDDED_SERVER = 1-DWITH_SSL = system
Parameter description:
-DCMAKE_INSTALL_PREFIX: Specifies the mysql main directory.
-DMYSQL_DATADIR: Specifies the data file storage location
-DSYSCONFDIR: Specifies the path of my. cnf.
-DMYSQL_UNIX_ADDR: Specifies the socket file path to connect to the database.
-DENABLED_LOCAL_INFILE = 1: Allow Local Data Import
-DEXTRA_CHARSETS = all: Install all character sets
-DDEFAULT_CHARSET = utf8: Specifies the default character
-DWITH_PARTITION_STORAGE_ENGINE = 1: Database partitions are supported during installation.
C. gmake
D. make install
5. cp related files and modification parameters:
A. Copy
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
B. Modify the parameters (create directory: mkdir/var/lib/mysql ):
[client]port = 53307socket = /usr/local/mysql/mysql.sock[mysql]no-auto-rehash[mysqld]user = mysqlport = 53307socket = /usr/local/mysql/mysql.sockbasedir = /usr/local/mysqldatadir = /usr/local/mysql/dataopen_files_limit=10240back_log = 600 max_connections = 3000 max_connect_errors = 6000 table_open_cache = 4096external-locking = FALSE max_allowed_packet = 32M sort_buffer_size = 2M join_buffer_size = 2M thread_cache_size = 300 thread_concurrency = 8 query_cache_size = 64M query_cache_limit = 4M query_cache_min_res_unit = 2k default-storage-engine = MyISAMthread_stack = 192K transaction_isolation = READ-COMMITTED tmp_table_size = 256Mmax_heap_table_size = 256Mslow-query-log=0slow_query_log_file=/usr/local/mysql/slow-log.loglong_query_time=2log-binbinlog_cache_size = 4Mmax_binlog_cache_size = 8Mmax_binlog_size = 512Mexpire_logs_days = 7key_buffer_size = 2048M read_buffer_size = 1M read_rnd_buffer_size = 16M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 10G myisam_repair_threads = 1 myisam_recover skip-name-resolvelower_case_table_names = 1[mysqldump]quickmax_allowed_packet = 32M[mysqld_safe]log-error=/usr/local/mysql/mysql_oldboy.errpid-file=/usr/local/mysql/mysqld.pid
6. Modify environment variables:
vim .bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
7. Run the mysql_install_db file:
./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/var/lib/mysql/ --no-default --user=mysql
8. Start the mysql service:
service mysql start
9. view the mysql process:
ps –ef|grep mysql