CentOS6.8 uses cmake to install MySQL5.7.18

CentOS6.8 uses cmake to install MySQL5.7.18

Referring to the online information, I used cmake to install MySQL5.7.18 on the CentOS6.8 server. I encountered various problems during the installation process. Most of the problems can be solved on the Internet. For the problems that could not be solved, I uninstalled and uninstalled them again, and finally the installation was successful. I sorted out the installation process and archived it for future use.

Install MySQL related dependencies:

yum -y install gcc gcc-c++ gcc-g77 make cmake bison ncurses-devel autoconf automake zlib* fiex* libxml* libmcrypt* libtool-ltdl-devel* libaio libaio-devel bzr libtool ncurses5-devel imake libxml2-devel expat-devel

Install boost_1_59_0 (must be this version):

1. Get the source code: If you download it to the /usr/local/src directory, enter the directory cd /usr/local/src and get the source code package

Copy the code as follows:
wget https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz/download

2. Decompression:

tar -xzvf boost_1_59_0.tar.gz

3. Enter the boost directory:

cd boost_1_59_0

4. Configure:

./bootstrap.sh

5. Compile:

./b2

6. Installation:

./b2 install

After the compilation and installation is complete, the boost header files will be copied to the /usr/local/include/ directory, and the library files will be in /usr/local/lib/.

Install cmake (latest version):

1. Get the source code: Still download it to the /usr/local/src directory, cd /usr/local/src, get the software package

wget https://cmake.org/files/v3.8/cmake-3.8.0.tar.gz

2. Decompression:

tar -xzvf cmake-3.8.0.tar.gz

3. Enter the cmake directory:

cd cmake-3.8.0

4. ./bootstrap

5. gmake

6. gmake install

Install mysql5.7.18:

1. Add mysql user and group:

/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql

2. Create MySQL installation directory and data directory

mkdir /usr/local/mysql
mkdir /usr/local/mysql/data

3. Modify the mysql directory owner

chown -R mysql:mysql /usr/local/mysql

4. Get the MySQL source package: still in the /usr/local/src directory

wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18.tar.gz

5. Decompression:

tar -xzvf mysql-5.7.18.tar.gz

6. Enter the mysql directory:

cd mysql-5.7.18

7. Cmake compilation configuration:

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DMYSQL_DATADIR=/usr/local/mysql/mydata \
-DSYSCONFDIR=/etc \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_SSL=yes \
-DWITH_BOOST=/usr/local/src/boost_1_59_0 \
-DMYSQL_USER=mysql

8. Compile and install:

make && make install

9. Go to the bin directory of MySQL installation and initialize the database

cd /usr/local/mysql/bin
./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data/ --basedir=/usr/local/mysql --socket=/usr/local/mysql/mysql.sock

After running, the last sentence [note] generates a mysql default password, copy it to a place and save it.

10. Add MySQL service, copy MySQL configuration file and return to MySQL installation directory cd ..
Enter the support-files directory cd support-files
Copy the startup file cp -a mysql.server /etc/init.d/mysql //-a can copy the original attributes together

11. The information on the Internet shows that there is a my.cnf file to be edited, but I did not find the my.cnf file after installation. I checked the information and it said that if there is no such configuration, the system default configuration will be run, so the configuration of my.cnf is omitted here.

12. Start MySQL

service mysql start

13. Set the system to start automatically

chkconfig mysql on

14. Log in to MySQL

Go to the bin directory of the MySQL installation directory and type cd bin

./mysql -uroot -p
Enter password: //Enter the default password saved previously

15. Change the root password

SET PASSWORD = PASSWORD('mysql123');

16. Refresh MySQL system permission related tables

flush privileges;

17. Exit mysql:

quit;

At this point, the compilation and installation is complete.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed tutorial on installing MySQL 5.7.20 on RedHat 6.5/CentOS 6.5
  • Solution to the initialization error when installing mysql5.7 from rpm package in centos6.5
  • CentOS 6.4 MySQL 5.7.18 installation and configuration method graphic tutorial
  • Tutorial on installing and configuring MySql5.7 in Alibaba Cloud ECS centos6.8
  • Centos6.9 installation Mysql5.7.18 step record
  • 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
  • Tutorial on installing MySQL 5.7.28 on CentOS 6.2 (mysql notes)

<<:  Summary of the switching problem and solution of installing multiple JDK versions in win10 64-bit system

>>:  Analysis and practice of React server-side rendering principle

Recommend

Install zip and unzip command functions under Linux and CentOS (server)

Install zip decompression function under Linux Th...

Implementation of CSS border length control function

In the past, when I needed the border length to b...

Table Tag (table) In-depth

<br />Table is a tag that has been used by e...

Solve the group by query problem after upgrading Mysql to 5.7

Find the problem After upgrading MySQL to MySQL 5...

Introduction and use of js observer mode

Table of contents I. Definition 2. Usage scenario...

Example of integrating Kafka with Nginx

background nginx-kafka-module is a plug-in for ng...

JS removeAttribute() method to delete an attribute of an element

In JavaScript, use the removeAttribute() method o...

Detailed tutorial on installing Hbase 2.3.5 on Vmware + Ubuntu18.04

Preface The previous article installed Hadoop, an...

Vue realizes cascading selection of provinces, cities and districts

Recently, I need to implement a cascading selecti...

Create a movable stack widget function using flutter

This post focuses on a super secret Flutter proje...