CentOS8 deploys LNMP environment to compile and install mysql8.0.29 tutorial details

1. Prerequisite

Since I have installed it several times, I will stop reporting the error, a little bit of a brainstorm! ! ! Resolve related dependencies and errors on the spot in advance.

1、 Required source code package

mysql-8.0.19.tar.gz 
boost_1_70_0.tar.gz		//Install mysql-8 required boost version
rpcsvc-proto-1.4.tar.gz		//Source code packages needed for subsequent errors

mysql-8.0.19 download address: http://mirrors.sohu.com/mysql/
boost_1_70_0 download address: https://dl.bintray.com/boostorg/release/1.70.0/source/
rpcsvc-proto-1.4 download address: https://github.com/thkukuk/rpcsvc-proto/releases/download/v1.4/

2、 Resolve dependencies

[14:41:21 root@wangzhike ~]#yum install -y cmake ncurses-devel

3、 Storage location

Software source code package storage location: /usr/local/src
Source code package compilation and installation location: /usr/local/software name

Two, compile and install mysql-8.0.19

1、 Upload source code package

boost_1_70_0.tar.gz		
mysql-8.0.19.tar.gz		
rpcsvc-proto-1.4.tar.gz

2、 Solve rpcsvc-proto-1.4

1 ), unzip

[17:05:14 root@wangzhike software]#tar -zxf rpcsvc-proto-1.4.tar.gz -C /usr/local/src/

2 ), one-step installation

[17:09:48 root@wangzhike rpcsvc-proto-1.4]#./configure && make && make install

3、 Solve boost_1_70_0

[17:13:48 root@wangzhike~]# mkdir -p /usr/local/boost
[17:14:05 root@wangzhike~]# cd /usr/local/src
[17:15:02 root@wangzhike src]#cp /software/boost_1_70_0.tar.gz /usr/local/boost/[17:26:22 root@wangzhike boost]#tar xf boost_1_70_0.tar.gz
////Upload only to/usr/local/src/Store directory, unzip to the current boost directory

4、 Create mysql user and group

[17:27:46 root@wangzhike ~]#groupadd mysql
[17:28:10 root@wangzhike ~]#useradd -g mysql mysql -s /bin/false
#### Create a user mysql and join the mysql group, do not allow mysql users to log in to the system directly
[17:28:11 root@wangzhike ~]#mkdir -p /data/mysql 
#### Create MySQL database storage directory
[17:29:13 root@wangzhike ~]#chown -R mysql:mysql /data/mysql 
#### Set MySQL database storage directory permissions
[17:29:31 root@wangzhike ~]#mkdir -p /usr/local/mysql 
#### Create MySQL installation directory

5、 Install mysql-8.0.19

1 ), unzip

[17:43:24 root@wangzhike software]#tar -zxf mysql-8.0.19.tar.gz -C /usr/local/src/[17:43:47 root@wangzhike software]#cd /usr/local/src/[17:43:53 root@wangzhike src]#cd mysql-8.0.19/

2 ),installation

[17:47:01 root@wangzhike mysql-8.0.19]#cmake . \
- DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
- DINSTALL_DATADIR=/data/mysql -DMYSQL_USER=mysql \
- DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DDEFAULT_CHARSET=utf8 \
- DDEFAULT_COLLATION=utf8_general_ci \
- DWITH_INNOBASE_STORAGE_ENGINE=1 \
- DWITH_EMBEDDED_SERVER=1 \
- DFORCE_INSOURCE_BUILD=1 \
- DWITH_MYISAM_STORAGE_ENGINE=1 \
- DENABLED_LOCAL_INFILE=1 \
- DEXTRA_CHARSETS=all \
- DWITH_BOOST=/usr/local/boost

There is nothing wrong with the following

CMake Warning: Manually-specified variables were not used by the
project:
EXTRA_CHARSETS INSTALL_DATADIR MYSQL_USER WITH_EMBEDDED_SERVER

– Build files have been written to: /usr/local/src/mysql-8.0.19

If the following error about rpc.h appears
Could not find rpc/rpc.h in /usr/include or /usr/include/tirpc

Solution:

[17:45:47 root@wangzhike mysql-8.0.19]#find /-name rpc.h
/usr/local/src/mysql-8.0.19/extra/libevent/include/event2/rpc.h
/usr/local/src/mysql-8.0.19/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/windeps/sunrpc/rpc/rpc.h

And copy rpc/rpc.h under /usr/local/src/mysql-8.0.19/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/windeps/sunrpc/ to /usr/include/

as follows

[17:52:57 root@wangzhike mysql-8.0.19]#cp -a /usr/local/src/mysql-8.0.19/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/windeps/sunrpc/rpc /usr/include/

3 )、make && install

[17:55:20 root@wangzhike mysql-8.0.19]#make -j 3 && install
//If the process is too long and the memory is insufficient, an error will be reported

Wait wait wait

If the following error is reported, it means that the memory is insufficient and the partition needs to be created

+: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]:***[sql/CMakeFiles/sql_gis.dir/build.make:154: sql/CMakeFiles/sql_gis.dir/gis/distance_functor.cc.o] Error 1
make[2]:*** Waiting for unfinished jobs....
make[1]:***[CMakeFiles/Makefile2:11144: sql/CMakeFiles/sql_gis.dir/all] Error 2
make:***[Makefile:163: all] Error 2

Create partition:

[19:58:37 root@wangzhike mysql-8.0.19]#dd if=/dev/zero of=/swapfile bs=1k count=20480002048000+0 records in2048000+0 records out
2097152000 bytes(2.1 GB,2.0 GiB) copied,6.07651 s,345 MB/s
#### Get the SWAP file block of 2G to be added
[20:10:02 root@wangzhike mysql-8.0.19]#mkswap /swapfile
mkswap:/swapfile: insecure permissions 0644,0600 suggested.
Setting up swapspace version 1, size =2GiB(2097147904 bytes)
no label, UUID=18a4bbb3-75d1-411b-ac0c-c87c63547509
#### Create SWAP file
[20:10:07 root@wangzhike mysql-8.0.19]#swapon /swapfile
swapon:/swapfile: insecure permissions 0644,0600 suggested.
#### Activate SWAP file
[20:10:12 root@wangzhike mysql-8.0.19]#swapon -s
Filename        Type   Size Used Priority
/dev/sda2        partition  2144252137300-2/swapfile        file   20479960-3
##### Check whether the SWAP information is correct
[20:10:19 root@wangzhike mysql-8.0.19]#echo "/var/swapfile swap swap defaults 0 0">>/etc/fstab
#### Add to the fstab file to automatically start the system when it boots

After re-executing make -j 3 && make install, there is no error when the following screen appears

``` bash
- - Installing:/usr/local/mysql/man/man1/comp_err.1-- Installing:/usr/local/mysql/man/man1/ibd2sdi.1-- Installing:/usr/local/mysql/man/man1/innochecksum.1-- Installing:/usr/local/mysql/man/man1/lz4_decompress.1-- Installing:/usr/local/mysql/man/man1/my_print_defaults.1-- Installing:/usr/local/mysql/man/man1/myisam_ftdump.1-- Installing:/usr/local/mysql/man/man1/myisamchk.1-- Installing:/usr/local/mysql/man/man1/myisamlog.1-- Installing:/usr/local/mysql/man/man1/myisampack.1-- Installing:/usr/local/mysql/man/man1/mysql.1-- Installing:/usr/local/mysql/man/man1/mysql.server.1-- Installing:/usr/local/mysql/man/man1/mysql_config.1-- Installing:/usr/local/mysql/man/man1/mysql_config_editor.1-- Installing:/usr/local/mysql/man/man1/mysql_secure_installation.1-- Installing:/usr/local/mysql/man/man1/mysql_ssl_rsa_setup.1-- Installing:/usr/local/mysql/man/man1/mysql_tzinfo_to_sql.1-- Installing:/usr/local/mysql/man/man1/mysql_upgrade.1-- Installing:/usr/local/mysql/man/man1/mysqladmin.1-- Installing:/usr/local/mysql/man/man1/mysqlbinlog.1-- Installing:/usr/local/mysql/man/man1/mysqlcheck.1-- Installing:/usr/local/mysql/man/man1/mysqld_multi.1-- Installing:/usr/local/mysql/man/man1/mysqld_safe.1-- Installing:/usr/local/mysql/man/man1/mysqldump.1-- Installing:/usr/local/mysql/man/man1/mysqldumpslow.1-- Installing:/usr/local/mysql/man/man1/mysqlimport.1-- Installing:/usr/local/mysql/man/man1/mysqlman.1-- Installing:/usr/local/mysql/man/man1/mysqlpump.1-- Installing:/usr/local/mysql/man/man1/mysqlshow.1-- Installing:/usr/local/mysql/man/man1/mysqlslap.1-- Installing:/usr/local/mysql/man/man1/perror.1-- Installing:/usr/local/mysql/man/man1/zlib_decompress.1-- Installing:/usr/local/mysql/man/man8/mysqld.8-- Installing:/usr/local/mysql/man/man1/mysqlrouter.1-- Installing:/usr/local/mysql/man/man1/mysqlrouter_passwd.1-- Installing:/usr/local/mysql/man/man1/mysqlrouter_plugin_info.1

Three, initialize the mysql database

1、 Modify mysql directory permissions

[20:37:59 root@wangzhike mysql-8.0.19]#chown -R mysql:mysql /usr/local/mysql
[20:42:07 root@wangzhike mysql-8.0.19]#chmod -R 755/usr/local/mysql

2、 Initialize mysql

[20:45:07 root@wangzhike ~]#cd /usr/local/mysql/[20:46:43 root@wangzhike mysql]#./bin/mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --character-set-server=utf8
2020- 04- 14 T12:47:13.718724Z 0[System][MY-013169][Server]/usr/local/mysql/bin/mysqld(mysqld 8.0.19) initializing of server in progress as process 98932020-04-14T12:47:13.719367Z 0[Warning][MY-013242][Server]--character-set-server:'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.2020-04-14T12:47:14.855541Z 5[Note][MY-010454][Server] A temporary password is generated for root@localhost: rUG-.8kdw<1f
#### Generate mysql system database.

3、 Modify the configuration file
mysql 8.0.x There is no configuration file by default, we create one ourselves.

[20:49:41 root@wangzhike mysql]#vi /usr/local/mysql/my.cnf
Add the following content:
[ client]
port=3306
socket=/tmp/mysql.sock
[ mysqld]
port=3306
user = mysql
socket=/tmp/mysql.sock
tmpdir =/tmp
key_buffer_size=16M
max_allowed_packet=128M
default_authentication_plugin=mysql_native_password
open_files_limit =60000
explicit_defaults_for_timestamp
server-id =1
character-set-server = utf8
federated
max_connections =1000
max_connect_errors =100000
interactive_timeout =86400
wait_timeout =86400
sync_binlog=0
back_log=100default-storage-engine = InnoDB
log_slave_updates =1[mysqldump]
quick
[ client]
password="123456"[mysqld-8.0]
sql_mode=TRADITIONAL
[ mysqladmin]
force
[ mysqld]
key_buffer_size=16M
service mysqld restart

: Wq! Save and exit
Note that the sentence service mysqld restart must be written, the default password is 123456

Other operations

[20:53:05 root@wangzhike mysql]#ln -s /usr/local/mysql/my.cnf /etc/my.cnf
# Soft link added to /etc directory
[20:53:12 root@wangzhike mysql]#cd
[20:53:13 root@wangzhike ~]#cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
# Add Mysql to the system to start
[20:53:21 root@wangzhike ~]#chmod 755/etc/init.d/mysqld
# Increase execution authority
[20:53:28 root@wangzhike ~]#chkconfig mysqld on
# Add boot

4、 Edit file

[20:53:39 root@wangzhike ~]#vi /etc/rc.d/init.d/mysqld

#### Find basedir= and modify it to /usr/local/mysql
#### Find datadir= and modify it to /data/mysql

basedir=/usr/local/mysql #MySQL program installation path
datadir=/data/mysql #MySQl database storage directory

5、 Boot up successfully

[20:54:32 root@wangzhike ~]#service mysqld start
Starting MySQL.Logging to&#39;/data/mysql/wangzhike.err&#39;.. SUCCESS! #Start successful

6、 Add variable

[20:54:44 root@wangzhike ~]#vi /etc/profile

Add export PATH=$PATH:/usr/local/mysql/bin in the last line

[20:55:37 root@wangzhike ~]#source /etc/profile #Make the configuration effective immediately

7、 Add soft connection

[20:55:44 root@wangzhike ~]#ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
[20:55:57 root@wangzhike ~]#ln -s /usr/local/mysql/include/mysql /usr/include/mysql
#### The above is to link the myslq library file to the system default location

[20:56:02 root@wangzhike ~]#mkdir /var/lib/mysql
[20:56:14 root@wangzhike ~]#ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

8、 Start mysql

[21:40:14 root@wangzhike ~]#mysql -uroot -p123456
Welcome to the MySQL monitor. Commands end with; or \g.
Your MySQL connection id is 9
Server version:8.0.19 Source distribution

Copyright(c)2000,2020, 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>

It means that the login is successful.

Recommended Posts

CentOS8 deploys LNMP environment to compile and install mysql8.0.29 tutorial details
Centos6.5 compile and install LNMP architecture web environment
CentOS Yum compile and install MySQL 5.6
CentOS7 compile and install L(A|N)MP environment
CentOS7.5 source code compile and install mysql5.7.29
Centos7 compile and install MySQL8 problem record
CentOS7.4 source code compile and install MySQL8.0
Centos7 install Mysql8 tutorial
Linux (CentOS7) using RPM to install mysql 8.0.11 tutorial
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
Centos7.2 compile and install way to build phpMyAdmin
CentOs7.3 compile and install Nginx 1.9.9
Centos compile and install Git
Centos compile and install LAMP (apache-2.4.7 + mysql-5.5.35 + php 5.5.8) + Redis
Centos7 compile and install ntp-4.2.8p11
CentOS 6.9 compile and install python
CentOS 6 compile and install python 3
Compile and install Lnmp shell script under Linux centos
How to compile and install PHP and Nginx in Ubuntu environment
CentOS7 yum install and start mysql
Compile and install LAMP under Centos 5.2
CentOS 6.x compile and install Nginx
CentOS7 yum install and start mysql
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
centos7 .*tar package to install MySQL5.7
Linux CentOS6 compile and install Pyt
Compile and install libmodbus library under CentOS7
Centos-6.5 installation and deployment of LNMP environment
Compile and install nodejs and yum in Centos8
Centos8 use yum to install rabbitmq tutorial
CentOS7 system yum way to install MySQL5.7
How to compile and install xdebug from source code in Ubuntu environment
CentOS7.2 install Mysql5.7.13
CentOS7 install MySQL
CentOS install mysql
CentOS7 install mysql
CentOS 7 install MySQL 5.6
CentOS8 install MySQL8.0
CentOS7 install mysql8
CentOS7 install MySQL8
centos 7.5 install mysql5.7.17
How to install and configure Elasticsearch on CentOS 7
How to install and use Docker on CentOS 7
How to install and configure VNC on CentOS 8
How to install and use Composer on CentOS 8
How to install and configure Redis on CentOS 8
How to install Node.js and npm on CentOS 8
How to install and configure phpMyAdmin on CentOS 6
How to install and use Curl on CentOS 8
How to install and configure Owncloud on CentOS 8
How to install and uninstall tomcat on centos
MySQL 8.0 installation, deployment and configuration tutorial on CentOS 8
How to install and configure Redmine on CentOS 8
Install centos7 and connect
install LNMP on centos7.4
CentOS6.7 build LNMP environment
CentOS6.5 offline install MySQL5.6.26
Install MySQL5.7 in centos7
Centos install MYSQL8.X tutorial
Install mysql5.7 under CentOS7
Centos install elasticsearch tutorial