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

Example of implementing the skeleton screen of WeChat applet

Table of contents What is a skeleton screen How t...

Javascript Virtual DOM Detailed Explanation

Table of contents What is virtual dom? Why do we ...

A Deep Dive into the MySQL InnoDB Storage Engine

Preface In MySQL, InnoDB belongs to the storage e...

Detailed explanation of MySql slow query analysis and opening slow query log

I have also been researching MySQL performance op...

Detailed explanation of the execution plan explain command example in MySQL

Preface The explain command is the primary way to...

Vue+SSM realizes the preview effect of picture upload

The current requirement is: there is a file uploa...

Vue realizes dynamic progress bar effect

This article example shares the specific code of ...

Is a design that complies with design specifications a good design?

In the past few years of my career, I have writte...

Using Apache ab to perform http performance testing

Mac comes with Apache environment Open Terminal a...

Detailed explanation of Linux tee command usage

The tee command is mainly used to output to stand...

Example of Vue uploading files using formData format type

In Vue, we generally have front-end and back-end ...

CSS implements 0.5px lines to solve mobile compatibility issues (recommended)

【content】: 1. Use background-image gradient style...

Essential knowledge for web development interviews and written tests (must read)

The difference between inline elements and block-...