"Linux" Mysql5.7.12 source compilation installation and configuration

Source: Internet
Author: User

Installation Environment

Linux (CentOS7.0 version), boost_1_59_0.tar.gz, mysql-5.7.12.tar.gz

MySQL 5.7 Key Features :

    • Better performance: For multi-core CPUs, solid-state drives, locks have better optimization, 100W QPS per second is no longer the pursuit of MySQL, the next version can be 200W QPS is our users more concerned about
    • A better InnoDB storage engine
    • More robust replication capabilities: Replication leads to a scenario where data is not lost at all, and traditional financial customers can choose to use the MySQL database. In addition, Gtid online smooth upgrade also becomes possible
    • Better optimizer: The meaning of Optimizer code refactoring will bring great improvements in this and later releases, Oracle is addressing MySQL's biggest challenge
    • Native JSON type support
    • Better geo-Information service support: InnoDB native support for geo-location types, support for Geojson,geohash features
    • New SYS library: This will be the most frequently accessed library for DBAs

Step One

To create a MySQL user group and users:

Groupadd mysqluseradd-r-G MySQL MySQL

To create a database-related directory:

Mkdir-p/home/program/mysqlmkdir-p/home/datamkdir-p/home/data/mysql

Step Two

Extract

Pre-compilation

CMake. -dcmake_install_prefix=/home/program/mysql-dmysql_datadir=/home/data/mysql-ddownload_boost=1 \   #从MySQL 5.7.5 Start BOOST Library is required-dwith_boost=/home/software/boost_1_59_0-dsysconfdir=/etc-dwith_innobase_storage_engine=1- Dwith_partition_storage_engine=1-dwith_federated_storage_engine=1-dwith_blackhole_storage_engine=1-dwith_ myisam_storage_engine=1-denabled_local_infile=1-denable_dtrace=0-ddefault_charset=utf8mb4-ddefault_collation= Utf8mb4_general_ci-dwith_embedded_server=1

Compiling the installation

Markmark Install Note: If you need to reload MySQL, do it again under/home/software/mysql-5.7.12, no need to cmake and make

Step Three

To clear the installation temp file

Make clean

Modify the directory Owner

CHOWN-RF MYSQL:MYSQL/HOME/PROGRAM/MYSQLCHOWN-RF Mysql:mysql/home/data/mysql
Configuring Startup files
Cp/home/program/mysql/support-files/mysql.server/etc/init.d/mysqldchmod +x/etc/init.d/mysqldchkconfig--add Mysqldchkconfig mysqld onservice MySQL start

/ETC/MY.CNF, for reference only
Cat >/etc/my.cnf << eof[client]port = 3306socket =/tmp/mysql.sockdefault-character-set = Utf8mb4[mysqld]port = 3306socket =/tmp/mysql.sockbasedir =/home/program/mysqldatadir =/home/data/mysqlpid-file =/home/data/mysql/ Mysql.piduser = mysqlbind-address = 0.0.0.0server-id = 1init-connect = ' SET NAMES utf8mb4 ' character-set-server = utf8mb4#s Kip-name-resolve#skip-networkingback_log = 300max_connections = 1000max_connect_errors = 6000open_files_limit = 65535table_open_cache = 128max_allowed_packet = 4mbinlog_cache_size = 1mmax_heap_table_size = 8Mtmp_table_size = 16Mread _buffer_size = 2mread_rnd_buffer_size = 8msort_buffer_size = 8mjoin_buffer_size = 8mkey_buffer_size = 4Mthread_cache_  Size = 8query_cache_type = 1query_cache_size = 8mquery_cache_limit = 2mft_min_word_len = 4log_bin = Mysql-binbinlog_format = Mixedexpire_logs_days = 30log_error =/data/mysql/mysql-error.logslow_query_log = 1long_query_time = 1slow_query_log_ File =/data/mysql/mysql-slow.logperformance_schema =0explicit_defaults_for_timestamp#lower_case_table_names = 1skip-external-lockingdefault_storage_engine = InnoDB# Default-storage-engine = myisaminnodb_file_per_table = 1innodb_open_files = 500innodb_buffer_pool_size = 64Minnodb_ Write_io_threads = 4innodb_read_io_threads = 4innodb_thread_concurrency = 0innodb_purge_threads = 1innodb_flush_log_at _trx_commit = 2innodb_log_buffer_size = 2minnodb_log_file_size = 32minnodb_log_files_in_group = 3innodb_max_dirty_ pages_pct = 90innodb_lock_wait_timeout = 120bulk_insert_buffer_size = 8mmyisam_sort_buffer_size = 8Mmyisam_max_sort_ File_size = 10gmyisam_repair_threads = 1interactive_timeout = 28800wait_timeout = 28800[mysqldump]quickmax_allowed_ Packet = 16m[myisamchk]key_buffer_size = 8msort_buffer_size = 8mread_buffer = 4mwrite_buffer = 4MEOF

Initializing the database

Note:

    1. Previous version mysql_install_db was under Mysql_basedir/script, 5.7 was placed in the Mysql_install_db/bin directory and has been discarded
    2. "--initialize" generates a random password (~/.mysql_secret), and "--initialize-insecure" does not generate a password
    3. --datadir cannot have data file under target directory
/home/program/mysql/bin/mysqld--initialize-insecure--user=mysql--basedir=/home/program/mysql--datadir=/home/ Data/mysql
Configuring Environment variables
Mysql_home=/usr/local/mysqlpath= $PATH: $mysql _home/bin
Source/etc/profile

"Linux" Mysql5.7.12 source compilation installation and configuration

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.