Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install MySQL5.7 with source code in CentOS7 environment

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how the source code installs MySQL5.7 in CentOS7 environment. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Install dependency packages

Yum-y install autoconf automake libtool cmake ncurses-devel openssl-devel lzo-devel zlib-devel gcc gcc-c++

Download the appropriate source package

Wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gzwget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12.tar.gz

Add mysql user

Useradd-M-s / sbin/nologin mysql

Decompress the source package

Tar zxvf boost_1_59_0.tar.gz-C / home/mysql # extract the file to tar zxvf mysql-5.7.12.tar.gz in the / home/mysql directory

Compile mysql

Cmake. -DCMAKE_INSTALL_PREFIX=/home/mysql/mysql_client/mysql-5.7-01\-DMYSQL_DATADIR=/home/mysql/mysql_data/mysql-5.7-01\-DDOWNLOAD_BOOST=1\-DWITH_BOOST=/home/mysql/boost_1_59_0\ # specify the location of the boost-DSYSCONFDIR=/etc/mysql\-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=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DEXTRA_CHARSETS=all\-DWITH_EMBEDDED_SERVER=1\-DMYSQL_TCP_PORT=3306

Compilation and installation

Make-j `grep processor / proc/cpuinfo | wc-l` # will consume a lot of memory when compiling, and a small amount of memory may not be able to compile and complete the make install# installation.

Configuration startup

Cp / home/mysql/mysql_client/mysql-5.7-01/support-files/mysql.server / etc/init.d/mysqld

Add executable permissions

Chmod + x / etc/init.d/mysqld # mysqld can modify the configuration file path of mysql

Configure the configuration / etc/my.cnf of mysql for reference only

[client] port = 3306socket = / home/mysql/mysql_data/mysql-5.7-01/mysql.sockdefault-character-set = UTF8 [mysqld] port = 3306socket = / home/mysql/mysql_data/mysql-5.7-01/mysql.sockbasedir = / home/mysql/mysql_client/mysql-5.7-01datadir = / home/mysql/mysql_data/mysql-5.7-01pid-file = / home/mysql/mysql_data/mysql-5.7-01/mysql/mysql.piduser = Mysqlbind-address = 0.0.0.0server-id = 1init-connect = 'SET NAMES utf8'character-set-server = utf8back_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 = / home/mysql/mysql_logs/mysql-5.7-01/mysql-binbinlog_format = mixedexpire_logs_days = 30log_error = / home/mysql/mysql_logs/mysql-5.7-01/mysql-error.logslow_query_log = 1long_query_time = 1slow_query_log_file = / home/mysql/mysql_logs/mysql-5.7-01 / Mysql-slow.logperformance_schema = 0explicit_defaults_for_timestampskip-external-lockingdefault_storage_engine = InnoDBinnodb_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 = 3innodbmaxfight dirtypages _ 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 = 4m

Remember to assign mysql-related folders to the mysql users we created earlier

Chown-R mysql.mysql mysql/

Initialize the database

/ home/mysql/mysql_client/mysql-5.7-01/bin/mysqld-- initialize-insecure-- user=mysql-- basedir=/home/mysql/mysql_client/mysql-5.7-01-- datadir=/home/mysql/mysql_data/mysql-5.7-01 #-initialize-insecure does not generate random passwords

Start the database

/ etc/init.d/mysqld start

Access to the database

/ home/mysql/mysql_client/mysql-5.7-01/bin/mysql-uroot-p Thank you for reading! On "CentOS7 environment how to install MySQL5.7 source code" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report