CentOs7 64-bit MySQL 5.6.40 source code installation process

CentOs7 64-bit MySQL 5.6.40 source code installation process

1. Install the dependency packages first to avoid problems during the installation process

[root@chufeng yusen]# yum -y install wget vim bash-completion
[root@chufeng yusen]# yum -y install gcc gcc-c++ cmake ncurses-devel autoconf perl perl-devel

2. Download mysql-5.6.40.tar.gz

MySQLxxx download address: https://dev.mysql.com/downloads/mysql/5.6.html#downloads

Source package address: https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.40.tar.gz

[root@chufeng yusen]# wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.40.tar.gz
[root@chufeng yusen]# ls
 mysql-5.6.40.tar.gz

3. Create the MySQL installation directory and data storage directory

[root@chufeng yusen]# mkdir -p /usr/local/mysql/data

4. Create users and user groups

[root@chufeng yusen]# groupadd mysql
[root@chufeng yusen]# useradd -r -g mysql mysql

5. Unzip the file to the current folder and install

[root@chufeng yusen]# tar -zxvf mysql-5.6.40.tar.gz
[root@chufeng yusen]# cd mysql-5.6.40
[root@chufeng mysql-5.6.40]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DINSTALL_DATADIR=/usr/local/mysql/data \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE=1
[root@chufeng mysql-5.6.40]# make && make install

CMAKE parameter description:

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql //Default installation directory

-DINSTALL_DATADIR=/usr/local/mysql/data //Database storage directory

-DDEFAULT_CHARSET=utf8 //Use utf8 characters

-DDEFAULT_COLLATION=utf8_general_ci //Check character

-DEXTRA_CHARSETS=all //Install all extended character sets

-DENABLED_LOCAL_INFILE=1 //Allow data to be imported from local

-DMYSQL_USER=mysql

-DMYSQL_TCP_PORT=3306

For detailed configuration of CMAKE, please refer to the MySQL official website

Note:

If the installation fails and you recompile, you need to clear the old object files and cache information.

[root@chufeng mysql-5.6.40]# make clean
[root@chufeng mysql-5.6.40]# rm -f CMakeCache.txt
[root@chufeng mysql-5.6.40]# rm -rf /etc/my.cnf

6. Set directory permissions

[root@chufeng yusen]# cd /usr/local/mysql
[root@chufeng mysql]# chown -R mysql:mysql .
[root@chufeng mysql]# chown -R mysql:mysql data

7. Add the mysql startup service to the system service

[root@chufeng yusen]# cd /usr/local/mysql
[root@chufeng mysql]# cp support-files/my-default.cnf /etc/my.cnf

8. Create a basic table

[root@chufeng yusen]# cd /usr/local/mysql
[root@chufeng mysql]# ./scripts/mysql_install_db --user=mysql

9. Configure environment variables (add the following two)

[root@chufeng yusen]# vim /etc/profile

export MYSQL_HOME="/usr/local/mysql"
export PATH="$PATH:$MYSQL_HOME/bin"

**#Load environment variables**
[root@chufeng yusen]# source /etc/profile

10. Add the mysql startup file to the system startup file

[root@chufeng yusen]# cd /usr/local/mysql/
[root@chufeng mysql]# cp support-files/mysql.server /etc/init.d/mysql

11.mysql start, stop and restart commands

Start mysql service

[root@chufeng yusen]# systemctl start mysql

Restart mysql service

[root@chufeng yusen]# systemctl restart mysql

Stop mysql service

[root@chufeng yusen]# systemctl stop mysql

Automatic startup

[root@chufeng yusen]# systemctl enable mysql

or:

Start mysql service

[root@chufeng yusen]# service mysql start

Restart mysql service

[root@chufeng yusen]# service mysql restart

Stop mysql service

[root@chufeng yusen]# service mysql stop

Add the service to the list of services managed by the boot command

chkconfig --add mysql

Automatic startup

chkconfig mysql on

12. Change mysql password

[root@chufeng yusen]# mysqladmin -u root password
New password: 
Confirm new password:
[root@chufeng yusen]#

13. Connect to MySQL

[root@chufeng yusen]# mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.40 Source distribution
Copyright (c) 2000, 2016, 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>

The mysql-5.6.40 source code installation is now complete.

Summarize

The above is the CentOs7 64-bit MySQL 5.6.40 source code installation process 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!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • 64-bit CentOs7 source code installation mysql-5.6.35 process sharing
  • MySQL 5.6 installation steps with pictures and text
  • MySQL 5.6 installation and configuration method graphic tutorial
  • Detailed diagram of MySQL 5.6 installation and configuration under Windows (large version)
  • MySQL5.6 installation diagram (windows7/8_64 bit)

<<:  How to install and configure SSH service in Ubuntu 18.04

>>:  Detailed examples of ajax usage in js and jQuery

Recommend

How to turn a jar package into a docker container

How to turn a jar package into a docker container...

XHTML introductory tutorial: Web page Head and DTD

Although head and DTD will not be displayed on th...

MySQL 8.0.17 installation and configuration method graphic tutorial

This article shares the installation and configur...

Design of pop-up windows and floating layers in web design

In the trend of gradual transition from tradition...

HTML5+CSS3 header creation example and update

Last time, we came up with two header layouts, on...

JS implements the rock-paper-scissors game

This article example shares the specific code of ...

Comprehensive inventory of important log files in MySQL

Table of contents Introduction Log classification...

How to handle super large form examples with Vue+ElementUI

Recently, due to business adjustments in the comp...

Detailed explanation of mktemp, a basic Linux command

mktemp Create temporary files or directories in a...

Practical method of upgrading PHP to 5.6 in Linux

1: Check the PHP version after entering the termi...

How to set background blur with CSS

When making some pages, in order to make the page...

Use javascript to create dynamic QQ registration page

Table of contents 1. Introduction 1. Basic layout...

CSS3 uses scale() and rotate() to achieve zooming and rotation

1. scale() method Zoom refers to "reducing&q...

CSS Standard: vertical-align property

<br />Original text: http://www.mikkolee.com...