CentOS 7 Operation Management Note (----MySQL source installation

Source: Internet
Author: User

MySQL can support multiple platforms, such as WINDOWS,UNIX,FREEBSD or other Linux systems. This essay records the process of installing MySQL using source code on CentOS 7.

1. Download the source code

Select the image file to use Beiligong:

Enter the following command in CentOS 7:

wget http://mirror.bit.edu.cn/mysql/downloads/mysql-5.6/mysql-5.6.31.tar.gz

2. Unzip the MySQL source zip file and update the software source

3. Install the required packages for compiling

Yum Install -y-make     gcc-c++   cmake   bison-devel  ncurses-devel   gcc   autoconf   automake   zlib*   fiex*   libxml*   libmcrypt*  libtool-ltdl-devel*

The results show the following error:

To find a way to respond to [Errno 256] online, use the following command:

Yum  Clean All Yum Makecache

After entering these two commands, re-download those compiled MySQL dependent software packages, this time one installation, not all packages are entered on the same command line:

Yum Install  Make Yum Install gcc-c++yuminstall -y cmake ...

This libxml* installation is normal, but it seems that the installation of fiex* is still a problem, and no matter, continue.

4. Generate makefile using the CMake command

Mr. Cheng/var/mysql/data Directory:

mkdir  -P  /var/mysql/data

About CMake Introduction See Baidu: Http://baike.baidu.com/link?url=N-Yk2wK5C807vyXsK58_93dRocV_ niitjkug8925auovjrknq2rououcxk2m1xc9u2vpz6wjhg18bwqtzrhh4a

Enter the following command:

[[Email protected]:~/downloads/mysql-5.7. -] # CMake>-dcmake_install_prefix=/usr/local/MySQL>-dmysql_datadir=/var/mysql/Data>-dsysconfdir=/etc>-dwith_myisam_storage_engine=1 >-dwith_innobase_storage_engine=1 >-dmysql_unix_addr=/tmp/Mysql.sock>-dmysql_tcp_port=3306 >-denabled_local_infile=1 >-dextra_charsets= All>-ddefault_charset=UTF8>-ddefault_collation=utf8_general_ci

The result is the following error:

Baidu Search CMake Error at cmake/boost.cmake:81 (MESSAGE), find such a webpage: http://www.cnblogs.com/chunguang/p/5553301.html

See the method is too messy, did not take a good look, directly chose the method of the second----but there is no effect;

Take a closer look at the error message that you just CMake:

Compared to the search of the Web page method one, the original method with CMake hint of the same, is more than a sentence cmake conditions:-ddownload_boost=1-dwith_boost=/usr/local/boost

[[Email protected]:~/downloads/mysql-5.7. -] # CMake>-dcmake_install_prefix=/usr/local/MySQL>-dmysql_datadir=/var/mysql/Data>-dsysconfdir=/etc>-dwith_myisam_storage_engine=1 >-dwith_innobase_storage_engine=1 >-dmysql_unix_addr=/tmp/Mysql.sock>-dmysql_tcp_port=3306 >-denabled_local_infile=1 >-dextra_charsets= All>-ddefault_charset=UTF8>-ddefault_collation=Utf8_general_ci>-ddownload_boost=1 \>-dwith_boost=/usr/local/boost

CMake, the following screen appears in the process:

This time CMake success:

5. Compiling

This process will take about 30 minutes ~ ~ ~

[[Email protected]:~/downloads/mysql-5.6 make

6. Installation

[Email protected]:~/downloads/mysql-5.6.  to  Make Install

The installation process takes about 5 minutes to get it done.

7. Add Users and Set permissions

[Email protected]:~/downloads/mysql-5.6.  ]# cd/usr/local/mysql# Add user [[email protected]:/usr/local/mysql]# groupadd mysql[[email Protected]:/usr/local/mysql]# useradd-r-g MySQL mysql# set permissions so that MySQL can modify files [[email protected]:chown -R mysql.mysql./[[email protected]:chown -R mysql.mysql/var/mysql/data# initializing database # You need to be aware that The data directory set here should be the same as the directory specified previously mysql_datadir [[email protected]:/usr/local/mysql]# scripts/mysql_install_db--usr=mysql   -ldata=/var/mysql/data

Execution Result:

Use the LL command to see the new my.cnf file.

Back up the MY.CNF

CP  MY.CNF   My.cnf.backup

Then modify the permissions of the appropriate directory for MySQL to modify:

Chown -R root./chown -R MySQL Data

When compiling MySQL parameters, this page has detailed description: http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html

8. Configure the MySQL configuration file as follows:

9. Set up MySQL for system service

(i) Place the startup script in the/ETC/INIT.D directory

(ii) Adding MYSQLD as a system service

(iii) Start the MySQL service

The error appears as shown above

Online search answers, http://blog.sina.com.cn/s/blog_637e04c9010117ri.html,http://www.jb51.net/article/48625.htm, thought might be because just set up the

chown  -R mysql.mysql./chown -R root./

And the MY.CNF configuration file did not make the correct modification, follow the error prompt just now (theserver quit without updating PID file (/var/mysql/data/javis)), Modify the My.cnf file as follows:

Start again

Success!

(iv) Setting a password for the root user

In the first red box, you are prompted to enter your password, because you have not set a password for the root user at this time, so do not enter anything, press ENTER directly.

Set the password to be set in the format of the second red box, put the password in parentheses in password (), and enclose it in single quotation marks.

After the display is correct, enter quit to quit.

Remember 2016-07-04-mon 20:11

CentOS 7 Operation Management Note (----MySQL source installation

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.