Compile and install the MySQL 5.7.9 under CentOS

Source: Internet
Author: User

MySQL 5.7 GA release, that is, from now on 5.7 can be used in the production environment, there are any problems the official will be repaired immediately.

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

MySQL 5.7 has been added as a database option to "Oneinstack"

Install dependent packages
Yum-y install gcc gcc-c++ ncurses ncurses-devel cmake
download the appropriate source package
Cd/root/oneinstack/srcwget Http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gzwget Http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.9.tar.gz
add MySQL user
Useradd-m-s/sbin/nologin MySQL
Pre-compilation
Tar xzf boost_1_59_0.tar.gztar xzf mysql-5.7.9.tar.gzmkdir-p/data/mysqlcd mysql-5.7.9cmake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql-ddownload_boost=1 \   #从MySQL 5.7.5 Start BOOST Library is required-dwith_boost=. /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
Make-j ' grep processor/proc/cpuinfo | Wc-l '  #编译很消耗系统资源, small memory may be compiled through make install
startup script, setting boot from boot
/bin/cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqldchmod +x/etc/init.d/mysqldchkconfig--add Mysqldchkconfig mysqld on
/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 =/usr/local/mysqldatadir =/data/mysqlpid-file =/data/mysql/mysql.piduser = mysqlb ind-address = 0.0.0.0server-id = 1init-connect = ' SET NAMES utf8mb4 ' character-set-server = utf8mb4#skip-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
/usr/local/mysql/bin/mysqld--initialize-insecure--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql

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
Start the database
Service mysqld Start
Set Database Password
Dbrootpwd=oneinstack  #数据库root密码/usr/local/mysql/bin/mysql-e "Grant all privileges on * * to [email protected] ' 127.0.0.1 ' identified by \ "$dbrootpwd \" with GRANT option; /USR/LOCAL/MYSQL/BIN/MYSQL-E "Grant all privileges on * * to [e-mail protected] ' localhost ' identified by \" $dbrootpwd \ "wi TH grant OPTION;

Original: https://blog.linuxeye.com/432.html

Compile and install the MySQL 5.7.9 under CentOS

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.