Linux CentOS6.5 under source code compilation install MySQL 5.6.16 "give the Force detailed tutorial"

Source: Internet
Author: User

First, compile and install MySQL before the preparatory work

Install the tools and libraries needed to compile the source code

Yum install gcc gcc-c++ ncurses-devel perl

Install CMake, download the source code from http://www.cmake.org and compile the installation

      1. wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz

      2. TAR-XZVF cmake-2.8.10.2.tar.gz

      3. CD cmake-2.8.10.2

      4. ./bootstrap; make; Make install

      5. CD ~

Second, set up MySQL users and groups

New MySQL user group

      1. Groupadd MySQL

New MySQL User

A. useradd-r-G MySQL MySQL

Iii. directories required for new MySQL

new MySQL installation project Record

A. mkdir-p/usr/local/mysql

New MySQL database data file directory

A. Mkdir-p/data/mysqldb

Download the MySQL source package and unzip it.

Download Mysql:http://pan.baidu.com/s/1jgngvee

      • Tar-zxv-f mysql-5.6.16.tar.gz

      • CD mysql-5.6.16

V. Compile and install MySQL

From mysql5.5 onwards, MySQL source installation started using CMake, set the source code compilation configuration script.

CMake \

-dcmake_install_prefix=/usr/local/mysql \

-dmysql_unix_addr=/usr/local/mysql/mysql.sock \

-ddefault_charset=utf8 \

-DDEFAULT_COLLATION=UTF8_GENERAL_CI \

-dwith_innobase_storage_engine=1 \

-dwith_archive_storage_engine=1 \

-dwith_blackhole_storage_engine=1 \

-dmysql_datadir=/mnt/soft/mysql/mysql_install_db_store \

-dmysql_tcp_port=3306 \

-denable_downloads=1

Special Note: The preceding spaces are required


Note: To rerun the configuration, you need to delete the CMakeCache.txt file

        1. RM CMakeCache.txt

Compiling source code

Make

Installation

        1. Make install

Vi. modifying MySQL directory Owners and Groups

Modify the owner of the MySQL installation directory

      • Cd/usr/local/mysql

        Chown-r Mysql:mysql.

Modifying the MySQL database file directory

      • Cd/data/mysqldb

      • Chown-r Mysql:mysql.

Vii. initializing MySQL Database
      • Cd/usr/local/mysql

      • scripts/mysql_install_db--user=mysql--datadir=/data/mysqldb

VIII. copy MySQL service startup configuration file
      1. Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf

Note: Overwrite if the/etc/my.cnf file exists.

IX. copy MySQL service startup script and join path path
    • CP Support-files/mysql.server/etc/init.d/mysqld

    • Vim/etc/profile

      Add at the end of the profile file:

      Path=/usr/local/mysql/bin:/usr/local/mysql/lib: $PATH

      Export PATH

    • Source/etc/profile



      Ten, start the MySQL service and join the boot-up ( optional This step, you can start it later )

      Service mysqld Start
      Chkconfig--level mysqld on

    Xi. check whether the MySQL service starts

          • netstat -tulnp | grep 3306   

          • mysql& Nbsp;-u root -p  

               password is empty, if you can log on, the installation is successful.


        Issues encountered:

         /etc/rc.d/init.d/mysqld startstarting mysql.manager o F Pid-file quit without updating file. [Failure] 

         ---------------------------

          Workaround:

          there is a step in the configuration of the CP support-files/my-medium.cnf/etc/my.cnf; For editing my.cnf, add: DataDir =/usr/local/mysql/data  under [mysqld];


        Settings allow remote access:

            ;  grant all privileges on * * to ' root ' @ '% ' identified by ' Sxb889961 ' with GRANT option; 

        Sets the root user's access password :

        Use MySQL;

        Update user Set Password=password (' 123456 ') where user= ' root ';

        Flush privileges;



Linux CentOS6.5 under source code compilation install MySQL 5.6.16 "give the Force detailed tutorial"

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.