CentOS 7 Source code compilation install Mysql 5.7

Source: Internet
Author: User
Tags chmod gz file

1. Create MySQL users, user groups, and related directories


/usr/sbin/groupadd MySQL

/usr/sbin/useradd-g MySQL MySQL

Mkdir-p/opt/local/mysql/data

Mkdir-p/opt/local/mysql/binlog

Mkdir-p/opt/local/mysql/logs

Mkdir-p/opt/local/mysql/relaylog

Mkdir-p/var/lib/mysql

Mkdir-p/opt/local/mysql/etc



2. Download Mysql 5.7 Latest version of tar.gz file


Go to the following address to select Download:

ftp://ftp.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.7/




3. Installation related dependencies


Yum-y install CMake ncurses ncurses-devel Bison bison-devel Boost Boost-devel




4, unzip, compile MySQL


Tar zxvf mysql-5.7.11.tar.gz


CD mysql-5.7.11


cmake-dcmake_install_prefix= "/opt/local/mysql"-ddefault_charset=utf8-dmysql_datadir= "/opt/local/mysql/data/"- dcmake_install_prefix= "/opt/local/mysql"-dinstall_plugindir=plugin-dwith_innobase_storage_engine=1-ddefault_ Collation=utf8_general_ci-denable_debug_sync=0-denabled_local_infile=1-denabled_profiling=1-dwith_zlib=system- Dwith_extra_charsets=none-dmysql_maintainer_mode=off-dextra_charsets=all-dwith_perfschema_storage_engine=1- Dwith_myisam_storage_engine=1-ddownload_boost=1-dwith_boost=/usr/local/boost


(-ddownload_boost=1 will automatically download the BOOST to the dwith_boost= specified directory or download it yourself and store it in the specified directory)


Make-j ' Cat/proc/cpuinfo | grep processor| Wc-l '


Make install




Ln-s/opt/local/mysql/lib/mysql/usr/lib/mysql

Ln-s/opt/local/mysql/include/mysql/usr/include/mysql

Ln-s/opt/local/mysql/bin/mysql/usr/bin/mysql

Ln-s/opt/local/mysql/bin/mysqldump/usr/bin/mysqldump

Ln-s/opt/local/mysql/bin/myisamchk/usr/bin/myisamchk

Ln-s/opt/local/mysql/bin/mysqld_safe/usr/bin/mysqld_safe

Ln-s/tmp/mysql.sock/var/lib/mysql/mysql.sock


Rm-rf/etc/my.cnf


Cp/opt/local/mysql/support-files/my-default.cnf/opt/local/mysql/etc/my.cnf


cd/opt/local/mysql/bin/


./mysqld--initialize--user=mysql--basedir=/opt/local/mysql--datadir=/opt/local/mysql/data


Generates a root random password, be sure to record it first. If you forget, please check (Cat/root/.mysql_secret)



chmod +w/opt/local/mysql

Chown-r Mysql:mysql/opt/local/mysql

chmod +w/var/lib/mysql

Chown-r Mysql:mysql/var/lib/mysql


Service mysqld Start



Mysql-uroot-p


Update Mysql.user set Authentication_string=password (' 888888 ') where user= ' root ' and Host = ' localhost ';


Flush privileges;



/opt/local/mysql/bin/mysql_secure_installation-uroot-p


CentOS 7 Source code compilation install Mysql 5.7

Related Article

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.