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

Flex layout realizes left text overflow and omits right text adaptation

I want to achieve a situation where the width of ...

A brief discussion on several specifications of JS front-end modularization

Table of contents Preface The value of front-end ...

How to use Vue3 mixin

Table of contents 1. How to use mixin? 2. Notes o...

One-click installation of MySQL 5.7 and password policy modification method

1. One-click installation of Mysql script [root@u...

How to smoothly upgrade and rollback Nginx version in 1 minute

Today, let's talk about a situation that is o...

Nginx compiled nginx - add new module

1. View existing modules /usr/local/nginx/sbin/ng...

Mysql case analysis of transaction isolation level

Table of contents 1. Theory SERIALIZABLE REPEATAB...

Vue realizes the function of book shopping cart

This article example shares the specific code of ...

How to change the mysql password on the Xampp server (with pictures)

Today, I found out while working on PHP that if w...

ElementUI component el-dropdown (pitfall)

Select and change: click to display the current v...

Three Ways to Find the Longest Word in a String in JavaScript (Recommended)

This article is based on the Free Code Camp Basic...

MySQL view introduction and basic operation tutorial

Preface View is a very useful database object in ...

Solution to MySQL garbled code problem under Linux

The project interacts with the server, accesses t...

Use and analysis of Mysql Explain command

The mysql explain command is used to show how MyS...