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

The process of compiling and installing MySQL 5.7.9 with source code

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

Share

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

This article mainly introduces the process of "source code compilation and installation of MySQL 5.7.9". In daily operation, I believe many people have doubts about the process of source code compilation and installation of MySQL 5.7.9. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "the process of source code compilation and installation of MySQL 5.7.9". Next, please follow the editor to study!

Install CentOS 6.3

Configure yum:

[root@hank-yoon ~] # cd / etc/yum.repos.d/

[root@hank-yoon yum.repos.d] # mkdir a

[root@hank-yoon yum.repos.d] # ls

A CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo

[root@hank-yoon yum.repos.d] # mv CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Vault.repo a

[root@hank-yoon yum.repos.d] # ls

A CentOS-Media.repo

[root@hank-yoon yum.repos.d] # vi CentOS-Media.repo

# CentOS-Media.repo

#

# This repo is used to mount the default locations for a CDROM / DVD on

# CentOS-6. You can use this repo and yum to install items directly off the

# DVD ISO that we release.

#

# To use this repo, put in your DVD and use it with the other repos too:

# yum-- enablerepo=c6-media [command]

#

# or for ONLY the media repo, do this:

#

# yum-- disablerepo=\ *-- enablerepo=c6-media [command]

[c6-media]

Name=CentOS-$releasever-Media

Baseurl= file:///media/CentOS/

# file:///media/cdrom/

# file:///media/cdrecorder/

Gpgcheck=1

Enabled=1

Gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Install dependent packages:

[root@hank-yoon yum.repos.d] # yum install-y ncurses-devel glibc gcc gcc-c++ libstdc++* libtool cmake lrzsz libaio-devel

Upload the source code installation package mysql-5.7.9.tar.gz and cmake-2.8.3.tar.gz:

[root@hank-yoon yum.repos.d] # cd / export/servers/

[root@hank-yoon servers] # ls

Cmake-2.8.3.tar.gz mysql-5.7.9.tar.gz

[root@hank-yoon servers] # tar-xvf cmake-2.8.3.tar.gz

[root@hank-yoon servers] # tar-xvf mysql-5.7.9.tar.gz

[root@hank-yoon servers] # ls

Cmake-2.8.3 cmake-2.8.3.tar.gz mysql-5.7.9 mysql-5.7.9.tar.gz

[root@hank-yoon servers] # cd cmake-2.8.3

[root@hank-yoon cmake-2.8.3] # ls

Bootstrap CMakeCPack.cmake CMakeLogo.gif Copyright.txt DartConfig.cmake Example Templates

ChangeLog.manual CMakeCPackOptions.cmake.in cmake_uninstall.cmake.in CTestConfig.cmake DartLocal.conf.in Modules Tests

ChangeLog.txt CMakeGraphVizOptions.cmake CompileFlags.cmake CTestCustom.cmake.in Docs Readme.txt Utilities

Cmake.1 CMakeLists.txt configure CTestCustom.ctest.in doxygen.config Source

[root@hank-yoon cmake-2.8.3] #. / configure

[root@hank-yoon cmake-2.8.3] # make & & make install

[root@hank-yoon mysql] # groupadd mysql

[root@hank-yoon mysql] # useradd-r-g mysql mysql

[root@hank-yoon export] # chown-R mysql.mysql / export/

[root@hank-yoon export] # mkdir-p data/mysql/data log tmp log dumps

An error was reported when compiling MySQL installation package:

CMake Error at cmake/boost.cmake:76 (MESSAGE):

You can download it with-DDOWNLOAD_BOOST=1-DWITH_BOOST=

This CMake script will look for boost in. If it is not there

It will download and unpack it (in that directory) for you.

If you are inside a firewall, you may need to use an http proxy:

Export http_proxy= http://example.com:80

Call Stack (most recent call first):

Cmake/boost.cmake:228 (COULD_NOT_FIND_BOOST)

CMakeLists.txt:435 (INCLUDE)

Configuring incomplete, errors occurred!

Download and install: wget https://cache.yisu.com/upload/information/20200703/141/24801 bootstrap.sh index.htm INSTALL libs more status

Boost-build.jam boost.css bootstrap.bat doc index.html Jamroot LICENSE_1_0.txt rst.css tools

[root@hank-yoon mysql-5.7.9] # pwd

/ export/mysql-5.7.9

[root@hank-yoon mysql-5.7.9] # cmake. -DCMAKE_INSTALL_PREFIX=/export/servers/mysql/-DMYSQL_DATADIR=/export/data/mysql/data-DSYSCONFDIR=/export/servers/mysql/etc-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_PERFSCHEMA_STORAGE_ENGINE=1-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DMYSQL_UNIX_ADDR=/export/data/mysql/tmp/mysql.sock-DENABLED_LOCAL_INFILE=ON-DENABLED_PROFILING=ON-DWITH_DEBUG=0-DENABLE_DTRACE=OFF-DMYSQL_TCP_PORT=3306-DDOWNLOAD_BOOST=1-DWITH_BOOST=/export/boost_1_59_0

-DCMAKE_INSTALL_PREFIX: specify the installation directory of the MySQL program. Default / usr/local/mysql

-DMYSQL_DATADIR: data file directory

-DSYSCONFDIR: initialization parameter file directory

-DWITH_INNOBASE_STORAGE_ENGINE: specifies static compilation to the MySQL storage engine

-DDEFAULT_CHARSET: default character set

-DMYSQL_TCP_PORT: default port

[root@hank-yoon mysql-5.7.9] # make & & make install

[root@hank-yoon bin] # pwd

/ export/servers/mysql/bin

Initialize the database:

[root@hank-yoon bin] # / mysqld-- initialize-insecure-- user=mysql-- basedir=/export/servers/mysql-- datadir=/export/data/mysql/data

Delete the default my.cnf file:

[root@hank-yoon bin] # rm-rf / etc/my.cnf

[root@hank-yoon bin] # / mysqld_safe-- defaults-file=/export/servers/mysql/etc/my.cnf &

Create a new profile my.cnf content:

[root@hank-yoon etc] # cat my.cnf

[client]

Port = 3358

Socket = / export/data/mysql/tmp/mysql.sock

[mysqld]

Port = 3358

Socket = / export/data/mysql/tmp/mysql.sock

Datadir = / export/data/mysql/data/

#-GLOBAL-#

Character-set-server = utf8

Lower_case_table_names = 1

Log-output = FILE

Log-error = / export/data/mysql/log/error.log

General_log = 0

General_log_file = / export/data/mysql/log/mysql.log

Pid-file = / export/data/mysql/mysql.pid

Slow-query-log

Slow_query_log_file = / export/data/mysql/log/slow.log

Tmpdir = / export/data/mysql/tmp

Long_query_time = 1

#-#

# thread_concurrency = 16

Thread_cache_size = 512

Table_open_cache = 16384

Table_definition_cache = 16384

Sort_buffer_size = 2m

Join_buffer_size = 2m

Read_buffer_size = 4m

Read_rnd_buffer_size = 4m

Key_buffer_size = 8m

Myisam_sort_buffer_size = 8m

Tmp_table_size = 64m

Max_heap_table_size = 64m

Open_files_limit = 65535

Query_cache_size = 0

# add z #

Innodb_undo_directory = / export/data/mysql/undo

Innodb_undo_tablespaces = 4

Explicit_defaults_for_timestamp = 1

#-NETWORK-#

Back_log = 1024

Max_allowed_packet = 16m

Interactive_timeout = 28800

Wait_timeout = 28800

Skip-external-locking

Max-connections = 1000

Skip-name-resolve

# read_only = 1

#-REPL-#

Server-id = 360360

Log-bin = mysql-bin

Binlog_format = mixed

Expire_logs_days = 7

Relay-log = relay-log

Replicate-ignore-db = mysql.slave_master_info

Replicate-ignore-db = mysql.slave_relay_log_info

Replicate-ignore-db = mysql.slave_worker_info

Replicate-ignore-db = test

Replicate-ignore-db = information_schema

Replicate-ignore-db = performance_schema

Log_slave_updates

Skip-slave-start

Slave-parallel-workers= 4

Sync_master_info = 1

Sync_relay_log = 1

Sync_relay_log_info = 1

Relay_log_info_repository = TABLE

Master_info_repository = TABLE

# rpl_semi_sync_master_enabled = 1

# rpl_semi_sync_slave_enabled = 1

# rpl_semi_sync_master_timeout = 1000

#-INNODB-#

Default-storage-engine = INNODB

Innodb_data_home_dir = / export/data/mysql/data

Innodb_file_per_table

Innodb_log_group_home_dir = / export/data/mysql/data

Innodb_log_files_in_group = 3

Innodb_log_file_size = 512m

Innodb_log_buffer_size = 16m

Innodb_flush_log_at_trx_commit = 1

Innodb_lock_wait_timeout = 120

Innodb_flush_method = O_DIRECT

Innodb_max_dirty_pages_pct = 75

# change z #

Sync_binlog = 1

Innodb_buffer_pool_size = 1G

Innodb_data_file_path = ibdata1:2G;ibdata2:2G:autoextend

Innodb_autoextend_increment = 500,

Innodb_thread_concurrency = 32

Innodb_open_files = 65535

Innodb_write_io_threads = 20

Innodb_read_io_threads = 20

Innodb_spin_wait_delay = 10

Innodb_flush_neighbors = 1

Innodb_use_native_aio = 1

Innodb_io_capacity = 2000

Innodb_io_capacity_max = 6000

Relay_log_recovery = 1

# innodb_additional_mem_pool_size = 128m

# change h #

# innodb_numa_interleave=ON

Innodb_lru_scan_depth=512

Innodb_checksum_algorithm=crc32

Innodb_purge_threads=4

[mysqldump]

Quick

Max_allowed_packet = 16m

[mysql]

# auto-rehash

# Remove the next comment character if you are not familiar with SQL

# safe-updates

Default-character-set=utf8

[myisamchk]

Key_buffer_size = 128m

Sort_buffer_size = 128m

Read_buffer = 2m

Write_buffer = 2m

[mysqlhotcopy]

Interactive-timeout

[root@hank-yoon log] # ps-ef | grep mysql

Root 26374 10192 0 16:53 pts/1 00:00:00 / bin/sh. / mysqld_safe-- defaults-file=/export/servers/mysql/etc/my.cnf

Mysql 27460 26374 0 16:53 pts/1 00:00:04 / export/servers/mysql/bin/mysqld-defaults-file=/export/servers/mysql/etc/my.cnf-basedir=/export/servers/mysql-datadir=/export/data/mysql/data/-plugin-dir=/export/servers/mysql/lib/plugin-user=mysql-log-error=/export/data/mysql/log/error.log-open-files-limit=65535-pid-file=/export/data/mysql/mysql. Pid-socket=/export/data/mysql/tmp/mysql.sock-port=3358

Reinitialize through a new configuration file without the need for a new password: (a random password is generated by default (~ / .mysql_secret)

[root@hank-yoon bin] #. / mysql

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 4

Server version: 5.7.9-log Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | sys |

+-+

4 rows in set (0.00 sec)

Add the variable location and execute the mysql command in any directory:

[root@hank-yoon ~] # vi .bash _ profile

PATH=$PATH:$HOME/bin:/export/servers/mysql/bin:/export/servers/mysql/bin

Export PATH

Export LANG=en_US.UTF-8

[root@hank-yoon ~] # source .bash _ profile

[root@hank-yoon ~] # mysql

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 6

Server version: 5.7.9-log Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql >

Configure to start the mysql command script through service:

[root@hank-yoon support-files] # pwd

/ export/mysql-5.7.9/support-files

[root@hank-yoon support-files] # cp mysql.server / etc/init.d/mysqld

[root@hank-yoon init.d] # chmod 755 mysqld

[root@hank-yoon init.d] # service mysqld start

Starting MySQL.. SUCCESS!

[root@hank-yoon init.d] # service mysqld stop

Shutting down MySQL.. SUCCESS!

Add the mysqld server to the self-startup item:

[root@hank-yoon] # chkconfig-- list mysqld

Service mysqld supports chkconfig, but is not referenced in any runlevel (run 'chkconfig-- add mysqld')

[root@hank-yoon] # chkconfig-- add mysqld

[root@hank-yoon] # chkconfig-- level 345 mysqld on

At this point, on the "source code compilation and installation of MySQL 5.7.9 process" on the end of the study, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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