CentOS6.9+Mysql5.7.18 source code installation detailed tutorial

CentOS6.9+Mysql5.7.18 source code installation detailed tutorial

CentOS6.9+Mysql5.7.18 source code installation, the following operations are performed under the root user.

1. Install dependent tools

cmake make3.75+ gcc4.4.6+ Boost1.59.0 bison ncurses
yum install -y cmake,make,gcc,gcc-c++,bison,ncurses,ncurses-devel
cd /opt

wget https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz

Or ask Baidu for one

tar -zxvf boost_1_59_0.tar.gz -C /usr/local/

2. Download MySQL and prepare for installation

git clone https://github.com/mysql/mysql-server.git

If there is no git, install it with yum install git

Select 5.7

Create a mysql user with the user group root

useradd -r -g root -s /bin/false mysql

3. Execute cmake

cd /opt/mysql-server5.7
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=/usr/local/boost_1_59_0 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DSYSCONFDIR=/etc \
-DEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=1 \
-DEXTRA_CHARSETS=all
-DCMAKE_INSTALL_PREFIX: installation path -DMYSQL_DATADIR: data storage directory -DWITH_BOOST: boost source code path -DSYSCONFDIR: my.cnf configuration file directory -DEFAULT_CHARSET: database default character encoding -DDEFAULT_COLLATION: default sorting rule -DENABLED_LOCAL_INFILE: allow data to be imported from this file -DEXTRA_CHARSETS: install all character sets 4. Compile and install make -j `grep processor /proc/cpuinfo | wc -l`
make install
The -j parameter specifies the number of threads during compilation based on the number of CPU cores, which can speed up compilation.
If the compilation fails midway, you need to delete the cache file of the pre-compilation configuration parameters generated by cmake and the file generated after make compilation, and then recompile.
cd /opt/mysql-server5.7
rm -f CMakeCache.txt
make clean

5. Initialize the system database

vim /etc/my.cnf

Enter insert mode and replace the original content with the following:

[client]
port=3306
socket=/temp/mysql.sock
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
skip-external-locking
skip-name-resolve
user=mysql
port=3306
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
tmpdir=/usr/local/mysql/temp
# server_id = .....
socket=/usr/local/mysql/mysql.sock
log-error=/usr/local/mysql/logs/mysql_error.log
pid-file=/usr/local/mysql/mysql.pid
open_files_limit=10240
back_log=600
max_connections=500
max_connect_errors=6000
wait_timeout=605800
#open_tables=600
#table_cache = 650
#opened_tables = 630
max_allowed_packet=32M
sort_buffer_size=4M
join_buffer_size=4M
thread_cache_size=300
query_cache_type=1
query_cache_size=256M
query_cache_limit=2M
query_cache_min_res_unit=16k
tmp_table_size=256M
max_heap_table_size=256M
key_buffer_size=256M
read_buffer_size=1M
read_rnd_buffer_size=16M
bulk_insert_buffer_size=64M
lower_case_table_names=1
default-storage-engine=INNODB
innodb_buffer_pool_size=2G
innodb_log_buffer_size=32M
innodb_log_file_size=128M
innodb_flush_method=O_DIRECT
#####################
thread_concurrency=32
long_query_time=2
slow-query-log=on
slow-query-log-file=/usr/local/mysql/logs/mysql-slow.log
[mysqldump]
quick
max_allowed_packet=32M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
cd /usr/local/mysql
mkdir data
mkdir logs
mkdir temp
chmod 0770 -R .
./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql --socket=/tmp/mysql.sock

In MySQL versions prior to 5.7.6, it was bin/mysql_install_db --user

After the execution is complete, check the logs/mysql_error.log file and write down the temporary root password in it.

A temporary password is generated for root@localhost: xxxxxxxxxx

6. Configure MySQL

chkconfig --add mysqld # Add to system service chkconfig mysqld on # Start at boot service mysqld start Startup failed, start in safe mode chown -R mysql:root /var/run/mysqld
./bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql &
./mysql -uroot -p

Enter the temporary password in mysql_error.log to log in to the mysql console

set password = 'asdfghjkl';
Query OK, 0 rows affected (0.00 sec)
show warnings;

Stop mysql

mysqladmin -u root -p shutdown

Enter the password you just set and stop successfully

Next, you can use the system service to start mysql:

service mysqld start # Start the mysql service

The above is the CentOS6.9+Mysql5.7.18 source code installation introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Centos6.9 installation Mysql5.7.18 step record
  • CentOS6.8 uses cmake to install MySQL5.7.18
  • Detailed tutorial on installing MySQL 5.7.18 under CentOS 6.5
  • Deploy MySQL 5.7.17 binary installation and multi-instance configuration on CentOS 6.5
  • Centos6.5 compile and install mysql 5.7.14 detailed tutorial
  • How to install Mysql5.7 in Centos6

<<:  How to make vue long list load quickly

>>:  Centos7 installation of Nginx integrated Lua sample code

Recommend

Introduction to several ways to introduce CSS in HTML

Table of contents 1. Embed CSS styles directly in...

A brief discussion on what situations in MySQL will cause index failure

Here are some tips from training institutions and...

Methods and techniques for quickly displaying web page images

1. Use .gifs rather than .jpgs. GIFs are smaller ...

Implementation of Docker to build private warehouse (registry and Harbor)

As more and more Docker images are used, there ne...

CocosCreator learning modular script

Cocos Creator modular script Cocos Creator allows...

Summary of various methods of MySQL data recovery

Table of contents 1. Introduction 2. Direct recov...

What are your principles for designing indexes? How to avoid index failure?

Table of contents Primary key index Create indexe...

How to Install and Configure Postfix Mail Server on CentOS 8

Postfix is ​​a free and open source MTA (Mail Tra...

TypeScript namespace merging explained

Table of contents Merge namespaces with the same ...

vue front-end HbuliderEslint real-time verification automatic repair settings

Table of contents ESLint plugin installation in H...

Specific use of the autoindex module in the Nginx Http module series

The main function of the brower module is to dete...

Commonplace talk about the usage of MYSQL pattern matching REGEXP and like

like LIKE requires the entire data to match, whil...

Web page HTML code: production of scrolling text

In this section, the author describes the special...

Detailed explanation of several methods of installing software in Linux

1. RPM package installation steps: 1. Find the co...