centos6.7 under compile and install MySQL5.7

Source: Internet
Author: User

centos6.7 Compile and install MySQL5.7 preparation work

#-----Dependent packages and MySQL and boost installation packages-----

#yum包安装:shell>Yum-YInstall GCC-c++ Ncurses-devel CMake Make Perl GCCautoconf automake zlib libxml libgcrypt libtool Bison #获取boost类库 (5. 7 compile requires Boost class library, specify boost path at compile time):shell>wgethttp//downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz#获取MySQL5.7Shell>wgethttp//cdn.mysql.com/downloads/mysql-5.7/mysql-5.7.9.tar.gz

#-----Create MySQL users and related directories-----

shell> groupadd mysql #创建MySQL组shell> Useradd-g501 mysql #创建MySQL用户shellmkdir -P/ data/mysql #创建MySQL安装目录shellmkdir /data/mysqldata #创建MySQL数据库文件存放目录shellchown -R Mysql:mysql/data/mysql/data/mysqldata

#-----Cmake-----

Shell>Tar-ZXVF./mysql-5.7.9.Tar. Gzshell> CD./mysql-5.7.9Shell>CMake-dcmake_install_prefix=/data/MySQL-dsysconfdir=/data/mysql/ -dmysql_datadir=/data/mysqldata/ -dmysql_unix_addr=/tmp/Mysql.sock-dmysql_tcp_port=3306 -dextra_charsets= All-ddefault_charset=UTF8-ddefault_collation=Utf8_general_ci-dwith_readline=1 -denabled_local_infile=1 -dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_partition_storage_engine=1 -dwith_memory_storage_engine=1 -dwith_boost=/usr/local/Boostshell> Make-j 'grepProcessor/proc/cpuinfo |WC-l ' Shell> Make Install* Compare consumption system resource configuration Low compilation may be slow *#初始化数据库 # Create a profile modify it for reference based on actual usageCat>/data/mysql/my.cnf <<Eof[client]port=3306Socket=/tmp/Mysql.sockdefault-character-set =UTF8MB4 [Mysqld]port=3306Socket=/tmp/Mysql.sock Basedir=/data/Mysqldatadir=/data/Mysqldatapid-file=/data/mysqldata/Mysql.piduser=Mysqlbind-address =0.0.0.0Server-ID=1Init-connect ='SET NAMES utf8mb4'character-set-server =utf8mb4 #skip-name-Resolve#skip-Networkingback_log= -max_connections= +max_connect_errors=6000Open_files_limit=65535Table_open_cache= -Max_allowed_packet=4mbinlog_cache_size=1mmax_heap_table_size=8mtmp_table_size=16M read_buffer_size=2mread_rnd_buffer_size=8msort_buffer_size=8mjoin_buffer_size=8mkey_buffer_size=4M thread_cache_size=8Query_cache_type=1query_cache_size=8mquery_cache_limit=2M Ft_min_word_len=4Log_bin= mysql-Binbinlog_format=mixedexpire_logs_days= -Log_error=/data/mysqldata/mysql-Error.logslow_query_log=1Long_query_time=1Slow_query_log_file=/data/mysqldata/mysql-Slow.log Performance_schema=0Explicit_defaults_for_timestamp #lower_case_table_names=1Skip-external-Locking Default_storage_engine=Innodb#default-storage-engine =myisaminnodb_file_per_table=1Innodb_open_files= -innodb_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= -Innodb_lock_wait_timeout= -bulk_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
#生成系统表
shell>/usr/local/mysql/bin/mysqld--initialize-insecure--user=mysql--basedir=/usr/local/mysql--datadir=/data /Mysqlshell> Service mysqld start
*注*:1. 之前版本mysql_install_db是在mysql_basedir/script下,5.7放在了mysql_install_db/bin目录下,且已被废弃,使用--initialize-insecure。2. –-initialize会生成一个随机密码(~/.mysql_secret),--initialize-insecure不会生成密码

#-----Set the environment variable and join the boot start-----

Echo ' export path= $PATH:/data/mysql/bin/ ' >>/etc/profileshell> source/etc/--add Myslqdchkconfig mysqld on

#-----Configure the root password for MySQL-----

shell> mysqlmysqlfor'root'@'localhost' = password ('qwerasdfzxcv'); MySQL> Flush privileges;

centos6.7 under compile and install MySQL5.7

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.