Big environment MySQL5.6 source code Installation Practice step by step teach you CentOS6.5 _ 64bit under the compilation and installation of MySQL-5.6.23 @ guoyJoe, centos6.5mysql5.6

Source: Internet
Author: User
Tags openssl rsa

Big environment MySQL5.6 source code Installation Practice step by step teach you CentOS6.5 _ 64bit under the compilation and installation of MySQL-5.6.23 @ guoyJoe, centos6.5mysql5.6

L reprint please indicate the source: http://blog.csdn.net/guoyjoe/article/details/44813039

1. Disable the Firewall

chkconfig iptables off service iptables stop 

2. Check whether MySQL is installed on the operating system.
[Root @ mydb1 backup] # rpm-qa | grep mysql
Qt-mysql-4.6.2-26.el6_4.x86_64
Mysql-5.1.71-1.el6.x86_64
Mysql-server-5.1.71-1.el6.x86_64
Mysql-devel-5.1.71-1.el6.x86_64
Mysql-libs-5.1.71-1.el6.x86_64


3. Delete MyQL (the mysql-libs that comes with the redhat6.3 Server is a mysql-libs-5.1.61-4.el6.x86_64 and may conflict with the mysql-libs of a later version)
Yum remove mysql-libs


4. Confirm that MySQL-related packages are completely deleted
[Root @ mydb1 backup] # rpm-qa | grep mysql


Download the mysqlsource code package in step 5, and mysql-5.6.23.tar.gz
Do not select other linux installation packages when downloading. Otherwise, an error is returned. Select Source Code, Select Platform: Source Code,
Download the Generic Linux (Architecture Independent) and Compressed TAR Archive.


6. Add users and groups:

Groupadd mysql # Add User Group useradd-d/home/mysql-g mysql


VII. Configure MySQL Environment Variables
Su-mysql
Vi. bash_profile
PATH = $ PATH: $ HOME/bin:/u01/my3306/bin
Source. bash_profile


8. Create a directory and grant permissions

mkdir -p /u01/my3306/datamkdir -p /u01/my3306/log/iblogmkdir -p /u01/my3306/log/binlogmkdir -p /u01/my3306/log/relaylogmkdir -p /u01/my3306/runmkdir -p /u01/my3306/tmpchown -R mysql:mysql /u01/my3306chmod -R 777 /u01/my3306

9. decompress the package
Tar-zxvf mysql-5.6.23.tar.gz
Cd mysql-5.6.23


10. Compile and install

cmake \-DCMAKE_INSTALL_PREFIX=/u01/my3306 \-DINSTALL_DATADIR=/u01/my3306/data  \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DEXTRA_CHARSETS=all \-DWITH_SSL=yes \-DWITH_EMBEDDED_SERVER=1 \-DENABLED_LOCAL_INFILE=1 \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_ARCHIVE_STORAGE_ENGINE=1 \-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \-DWITH_FEDERATED_STORAGE_ENGINE=1 \-DWITH_PARTITION_STORAGE_ENGINE=1 \-DMYSQL_UNIX_ADDR=/u01/my3306/run/mysql.sock \-DMYSQL_TCP_PORT=3306 \-DENABLED_LOCAL_INFILE=1 \-DSYSCONFDIR=/etc \-DWITH_READLINE=onmakemake install

11. parameter configuration/u01/my3306/my. cnf

[client]port=3306socket=/u01/my3306/mysql.sock[mysql]pid_file=/u01/my3306/run/mysqld.pid[mysqld]# disable autocommitautocommit=0general_log=offexplicit_defaults_for_timestamp=truesha256_password_private_key_path=/u01/my3306/mykey.pemsha256_password_public_key_path=/u01/my3306/mykey.pub# systembasedir=/u01/my3306datadir=/u01/my3306/datamax_allowed_packet=134217728max_connections=8192max_user_connections=8000open_files_limit=65535pid_file=/u01/my3306/run/mysqld.pidport=3306server_id=101skip_name_resolve=ONsocket=/u01/my3306/run/mysql.socktmpdir=/u01/my3306/tmp#binlog#log-bin=/u01/my3306/log/binloglog_bin=/u01/my3306/log/binlog/binlogbinlog_cache_size=32768binlog_format=rowexpire_logs_days=7log_slave_updates=ONmax_binlog_cache_size=2147483648max_binlog_size=524288000sync_binlog=100#logginglog_error=/u01/my3306/log/alert.logslow_query_log_file=/u01/my3306/log/slow.loglog_queries_not_using_indexes=1slow_query_log=1log_slave_updates=ONlog_slow_admin_statements=1long_query_time=1#relayrelay_log=/u01/my3306/log/relaylogrelay_log_index=/u01/my3306/log/relay.indexrelay_log_info_file=/u01/my3306/log/relay-log.info#slaveslave_load_tmpdir=/u01/my3306/tmpslave_skip_errors=OFF#innodbinnodb_data_home_dir=/u01/my3306/log/ibloginnodb_log_group_home_dir=/u01/my3306/log/ibloginnodb_adaptive_flushing=ONinnodb_adaptive_hash_index=ONinnodb_autoinc_lock_mode=1innodb_buffer_pool_instances=8#defaultinnodb_change_buffering=insertsinnodb_checksums=ONinnodb_buffer_pool_size= 128Minnodb_data_file_path=ibdata1:32M;ibdata2:16M:autoextendinnodb_doublewrite=ONinnodb_file_format=Barracudainnodb_file_per_table=ONinnodb_flush_log_at_trx_commit=1innodb_flush_method=O_DIRECTinnodb_io_capacity=1000innodb_lock_wait_timeout=10innodb_log_buffer_size=67108864innodb_log_file_size=1048576000innodb_log_files_in_group=4innodb_max_dirty_pages_pct=60innodb_open_files=60000innodb_purge_threads=1innodb_read_io_threads=4innodb_stats_on_metadata=OFFinnodb_support_xa=ONinnodb_use_native_aio=OFFinnodb_write_io_threads=10[mysqld_safe]datadir=/u01/my3306/data

12. initialize the MySQL script

rm -rf /u01/my3306/data/*rm -rf /u01/my3306/log/iblog/*rm -rf /u01/my3306/log/binlog/*chmod -R 777 /u01/my3306/data/chmod -R 777 /u01/my3306/log/iblog/chmod -R 777 /u01/my3306/log/binlog/chmod 755 /u01/my3306/my.cnf./scripts/mysql_install_db  --defaults-file=/u01/my3306/my.cnf --datadir=/u01/my3306/data --user=mysqlchmod -R 777 /u01/my3306/data/chmod -R 777 /u01/my3306/log/iblog/chmod -R 777 /u01/my3306/log/binlog/
Defaults-file indicates to specify the default configuration file. If this parameter is not specified, the default priority of the system is to use/etc/my first. cnf is used as the mysql configuration file, and those parameters of make are set in whitelist.


Log monitoring at initial stage
Tail-f/u01/my3306/log/alert. log


**************************************** **************************************** ******************************
Error handling:
RSA private key file not found:/u01/my3306/data // private_key.pem. Some authentication plugins will not work.
RSA public key file not found:/u01/my3306/data // public_key.pem. Some authentication plugins will not work.

The solution is as follows:
1. Check whether openssl is installed
$ Rpm-qa openssl
Openssl-1.0.0-20.el6_2.5.x86_64

2. Use openssl to generate public and private keys
$ Openssl genrsa-out mykey. pem 1024
Generating RSA private key, 1024 bit long modulus
...
. ++
E is 65537 (0x10001)

$ Openssl rsa-in mykey. pem-pubout-out mykey. pub
Writing RSA key


$ Ll mykey *
[Root @ mydb1 my3306] # ll mykey *
-Rw-r -- 1 root 891 Apr 1 20:35 mykey. pem
-Rw-r -- 1 root 272 Apr 1 20:35 mykey. pub

3. Modify key Permissions
Chmod 755/u01/my3306/mykey. pem
Chmod 755/u01/my3306/mykey. pub
$ Ll mykey *
[Root @ mydb1 my3306] # ll mykey *
-Rwxr-xr-x 1 root 891 Apr 1 mykey. pem
-Rwxr-xr-x 1 root 272 Apr 1 mykey. pub

4. Add the parameter to [mysqld]: vi my. cnf
[Mysqld]
Sha256_password_private_key_path =/u01/my3306/mykey. pem
Sha256_password_public_key_path =/u01/my3306/mykey. pub
**************************************** **************************************** **************

13. Start mysql

Vi. bash_profile --- add PATH = $ PATH: $ HOME/bin:/u01/my3306/binmysqld_safe -- defaults-file =/u01/my3306/my under the root user. cnf -- user = mysql &

14. log on to MySQL

[root@uubee8 ~]# mysql -h127.0.0.1 -urootWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.6.23-log Source distributionCopyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show variables like '%log-bin%';Empty set (0.00 sec)mysql> show variables like '%bin%';+-----------------------------------------+------------------------------+| Variable_name                           | Value                        |+-----------------------------------------+------------------------------+| bind_address                            | *                            || binlog_cache_size                       | 32768                        || binlog_checksum                         | CRC32                        || binlog_direct_non_transactional_updates | OFF                          || binlog_error_action                     | IGNORE_ERROR                 || binlog_format                           | ROW                          || binlog_gtid_simple_recovery             | OFF                          || binlog_max_flush_queue_time             | 0                            || binlog_order_commits                    | ON                           || binlog_row_image                        | FULL                         || binlog_rows_query_log_events            | OFF                          || binlog_stmt_cache_size                  | 32768                        || binlogging_impossible_mode              | IGNORE_ERROR                 || innodb_api_enable_binlog                | OFF                          || innodb_locks_unsafe_for_binlog          | OFF                          || log_bin                                 | ON                           || log_bin_basename                        | /u01/my3306/log/binlog       || log_bin_index                           | /u01/my3306/log/binlog.index || log_bin_trust_function_creators         | OFF                          || log_bin_use_v1_row_events               | OFF                          || max_binlog_cache_size                   | 2147483648                   || max_binlog_size                         | 524288000                    || max_binlog_stmt_cache_size              | 18446744073709547520         || simplified_binlog_gtid_recovery         | OFF                          || sql_log_bin                             | ON                           || sync_binlog                             | 100                          |+-----------------------------------------+------------------------------+26 rows in set (0.00 sec)

######################################## ######################################## ######################################## ##########

1. initialize the MySQL script: sh init3306.shrm-rf/u01/my3306/data/* rm-rf/u01/my3306/log/iblog/* rm-rf/u01/my3306/log/binlog/* chmod- R 777/u01/my3306/data/chmod-R 777/u01/my3306/log/iblog/chmod-R 777/u01/my3306/log/binlog/chmod 755/u01/ my3306/my. cnf. /scripts/mysql_install_db -- defaults-file =/u01/my3306/my. cnf -- datadir =/u01/my3306/data -- user = mysqlchmod-R 777/u01/my3306/data/chmod-R 777/u01/my3306/log/iblog/chmod-R 777/u01/my3306/log/binlog/2. start MySQL script sh start3306.shmysqld _ safe -- defaults-file =/u01/my3306/my. cnf -- user = mysql & 3. log on to the MySQL script sh logon3306.shmysql-h127.0.0.1-uroot.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.