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

TCP performance tuning implementation principle and process analysis

Three-way handshake phase Number of retries for c...

Solution to web page confusion caused by web page FOUC problem

FOUC is Flash of Unstyled Content, abbreviated as ...

Let IE support CSS3 Media Query to achieve responsive web design

Today's screen resolutions range from as smal...

How to operate Docker and images

Find mirror We can search for images from the Doc...

Vue+Router+Element to implement a simple navigation bar

This project shares the specific code of Vue+Rout...

Three principles of efficient navigation design that web designers must know

Designing navigation for a website is like laying...

How to display small icons in the browser title bar of HTML webpage

Just like this effect, the method is also very si...

Detailed explanation of the difference between alt and title

These two attributes are often used, but their di...

How to use default values ​​for variables in SASS

Variables defined in SASS, the value set later wi...

Detailed tutorial on installing the jenkins container in a docker environment

Recommended Docker learning materials: https://ww...

Vue implements card flip carousel display

Vue card flip carousel display, while switching d...