CentOS7.2.1511 installation Mysql-5.7.13

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"

1). MySQL Environment installation configuration:
Install dependency Package: yum-y install gcc gcc-c++ ncurses ncurses-devel cmake Download the corresponding source bundle: wget http://cdn.mysql.com/Downloads/MySQL-5.7/ Mysql-5.7.13.tar.gzwget Http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13.tar.gzwget/HTTP downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz add MySQL User: Useradd-m-s/sbin/nologin MySQL precompilation: tar zxvf boost_1_59_0.tar.gzcd boost_1_59_0 &&./bootstrap.sh &&./b2 &&./b2 Install ( Unzip to choose to install) tar zxvf mysql-5.7.13.tar.gzcd mysql-5.7.13cmake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/usr/local/mysql/data-ddownload_boost=1 \-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_systemd=1-dwith _embedded_server=1 (red: plus-dwith_systemd=1 can use SYSTEMD controlMySQL service, default is not turned on SYSTEMD) compilation installation: Make-j ' grep processor/proc/cpuinfo | Wc-l ' Make install

1.1). Initialization of the database:

Cd/usr/local/mysql && chown-r mysql:mysql.    Bin/mysqld--initialize-insecure--user=mysql  --basedir=/usr/local/mysql--datadir=/usr/local/mysql/databin/ Mysql_ssl_rsa_setupchown-r Root. && chown-r mysql data  (red: "--initialize" generates a random password (~/.mysql_secret), and "--initialize-insecure" does not generate a password-- DataDir cannot have data file under target directory)

1.2). Create a configuration file, start a database

MV/ETC/MY.CNF My.cnf.bak    ---Rename or delete the default generation MY.CNF or the startup service will error Cd/usr/local/mysql/support-files     --- Go to MySQL installation directory support file directory CP my-default.cnf/etc/my.cnf    ---Copy the template for the new profile, modify the configuration options in the file as needed if you do not modify the configuration MySQL then run by default configuration parameters.       # # MySQL defaults to installing the Mysqld.service file into the MySQL installation directory of usr/lib/systemd/system/, copying Mysqld.service to/usr/lib/systemd/ cd/usr/local/mysql/&& CP usr/lib/systemd/system/mysqld.service/usr/lib/systemd/system/## in the system/directory In Mysqld.service, the default PID file is assigned to the/var/run/mysqld/directory, and the directory is not established beforehand, so the directory is created manually and the permissions are assigned to the MySQL user. Cd/var/run && sudo mkdir mysqld  && sudo chown-r mysql mysqld  && sudo chgrp-r mysql mysq LD  # # starts Mysql:sysstemctl start mysqld
1.3). Create user, and open network login
/usr/loca/mysql/bin/mysql-uroot use    mysql;    UPDATE user SET authentication_string = PASSWORD (' test2015 ') WHERE user = ' root ';    GRANT all privileges on * * to [email protected] '% ' identified by ' rootpasswd ';    FLUSH privileges;## Creating User: Create users bom;update User set Authentication_string=password ("123456") where user= "BOM";  Grant all on bom.* to ' BOM ' @ ' localhost '; Create user backup;update user set Authentication_string=password ("123456") where User= "Backup"; Grant all on * * to ' backup ' @ ' localhost ';
/ETC/MY.CNF Reference
  • [Client]
  • Port = 3306
  • Socket =/tmp/mysql.sock
  • Default-character-set = Utf8mb4
  • [Mysqld]
  • Port = 3306
  • Socket =/tmp/mysql.sock
  • Basedir =/usr/local/mysql
  • DataDir =/data/mysql
  • Pid-file =/data/mysql/mysqld.pid
  • user = MySQL
  • Bind-address = 0.0.0.0
  • Server-id = 1
  • Init-connect = ' SET NAMES utf8mb4 '
  • Character-set-server = Utf8mb4
  • #skip-name-resolve
  • #skip-networking
  • Back_log = 300
  • max_connections = 1000
  • Max_connect_errors = 6000
  • Open_files_limit = 65535
  • Table_open_cache = 128
  • Max_allowed_packet = 4M
  • Binlog_cache_size = 1M
  • Max_heap_table_size = 8M
  • Tmp_table_size = 16M
  • Read_buffer_size = 2M
  • Read_rnd_buffer_size = 8M
  • Sort_buffer_size = 8M
  • Join_buffer_size = 8M
  • Key_buffer_size = 4M
  • Thread_cache_size = 8
  • Query_cache_type = 1
  • Query_cache_size = 8M
  • Query_cache_limit = 2M
  • Ft_min_word_len = 4
  • Log_bin = Mysql-bin
  • max_binlog_cache_size=8M
  • Max_binlog_size=1024M
  • Binlog_format = Mixed
  • Expire_logs_days = 30
  • Log_error =/data/mysql/mysql-error.log
  • Slow_query_log = 1
  • Long_query_time = 1
  • Slow_query_log_file =/data/mysql/mysql-slow.log
  • Performance_schema = 0
  • Explicit_defaults_for_timestamp
  • #lower_case_table_names = 1
  • Skip-external-locking
  • Default_storage_engine = InnoDB
  • #default-storage-engine = MyISAM
  • innodb_file_per_table = 1
  • Innodb_open_files = 500
  • Innodb_buffer_pool_size = 64M
  • Innodb_write_io_threads = 4
  • Innodb_read_io_threads = 4
  • innodb_thread_concurrency = 0
  • Innodb_purge_threads = 1
  • Innodb_flush_log_at_trx_commit = 2
  • Innodb_log_buffer_size = 2M
  • Innodb_log_file_size = 32M
  • Innodb_log_files_in_group = 3
  • innodb_max_dirty_pages_pct = 90
  • Innodb_lock_wait_timeout = 120
  • Bulk_insert_buffer_size = 8M
  • Myisam_sort_buffer_size = 8M
  • Myisam_max_sort_file_size = 10G
  • Myisam_repair_threads = 1
  • Interactive_timeout = 28800
  • Wait_timeout = 28800
  • [Mysqldump]
  • Quick
  • Max_allowed_packet = 16M
  • [Myisamchk]
  • Key_buffer_size = 8M
  • Sort_buffer_size = 8M
  • Read_buffer = 4M
  • Write_buffer = 4M

CentOS7.2.1511 installation Mysql-5.7.13

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.