Compile and install mysql5.7 in centos 7, centosmysql5.7

Source: Internet
Author: User

Compile and install mysql5.7 in centos 7, centosmysql5.7

I. Installation conventions

Mysql installation path:/usr/local/mysql

Mysql database path: /data/mysql

My configuration file path: /usr/local/mysql/my.cnf

Ii. Uninstall mariadb

# Rpm-qa | grep mariadb # rpm-e -- nodeps mariadb-libs-5.5.37-1.el7_0.x86_64 package name is learned FROM THE PREVIOUS QUERY

3. create user groups and users

Add a mysql Groupgroupadd mysql

Add Useruseradd -g mysql mysql -s /bin/false

# Download the source code package

Download the latest version from the following URL on the official website:

Http://dev.mysql.com/downloads/mysql/5.7.html#downloads

Http://download.savannah.gnu.org/releases/libunwind/

Https://github.com/gperftools/gperftools/releases

# cd /usr/local/src/# wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz# wget http://gperftools.googlecode.com/files/gperftools-2.5.tar.gz# wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.x.tar.gz

Libunwind Installation

# tar zxvf libunwind-1.1.tar.gz# cd libunwind-1.1# ./configure# make# make install

Install gperftools

# cd ..# tar zxvf gperftools-2.1.tar.gz# cd gperftools-2.1# ./configure# make# make install# echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf# ldconfig

Install mysql

# cd ..# tar zxvf mysql-5.7.x.tar.gz# cd mysql-5.7.x

Run the following command to view the compilation parameter description before Compilation:

# cmake . -LH | more

If an error is reported in the intermediate process, delete cmakecache.txt and re-compile it.

rm -rf CMakeCache.txt

Mysq compilation and Installation

# Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \-keys =/data/mysql \-DSYSCONFDIR =/etc \-DEXTRA_CHARSETS = all \-DDEFAULT_CHARSET = utf8 \-DDEFAULT_COLLATION = begin \-DWITH_INNOBASE_STORAGE_ENGINE = 1 \-DENABLED_LOCAL_INFILE = 1 \-DMYSQL_UNIX_ADDR =/dev/shm/mysql. sock \-DMYSQL_TCP_PORT = 3306 \-DMYSQL_USER = mysql \-DWITH_DEBUG = 0 \-DDOWNLOAD_BOOST = 1 \-DWITH_BOOST =/usr/local/boost # make install ''' change permission ''' # chmod 755/var/lib/mysql # cd/usr/local/mysql # chown-R mysql: mysql.

Initialize mysql

/usr/local/mysql/bin/mysqld --initialize --basedir=/usr/local/mysql --datadir=/data/mysql --user=mysql --explicit_defaults_for_timestamp=1

Create a mysql configuration file

# cp support-files/my-default.cnf /usr/local/mysql/my.cnf

Summary

The above is all about this article. I hope this article will help you in your study or work. If you have any questions, please leave a message.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.