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

Sample code for implementing honeycomb/hexagonal atlas with CSS

I don’t know why, but UI likes to design honeycom...

Detailed explanation of Java calling ffmpeg to convert video format to flv

Detailed explanation of Java calling ffmpeg to co...

Hyperlink icon specifications: improve article readability

1. What is the hyperlink icon specification ?<...

Examples of new selectors in CSS3

Structural (position) pseudo-class selector (CSS3...

Detailed explanation of Linux environment variable configuration strategy

When customizing the installation of software, yo...

The basic principles and detailed usage of viewport

1. Overview of viewport Mobile browsers usually r...

Docker builds jenkins+maven code building and deployment platform

Table of contents Docker Basic Concepts Docker in...

An article to help you understand the basics of VUE

Table of contents What is VUE Core plugins in Vue...

Let's talk about my understanding and application of React Context

Table of contents Preface First look at React Con...

About if contains comma expression in JavaScript

Sometimes you will see English commas ",&quo...

Example to explain the size of MySQL statistics table

Counting the size of each table in each database ...

W3C Tutorial (6): W3C CSS Activities

A style sheet describes how a document should be ...

How to Clear Disk Space on CentOS 6 or CentOS 7

Following are the quick commands to clear disk sp...

How to create a MySQL database and support Chinese characters

Let's first look at the MySQL official docume...

CSS3 realizes the glowing border effect

Operation effect: html <!-- This element is no...