Source compiled MySQL

Source: Internet
Author: User

Compile source package MySQL

mysql-5.1 includes previous versions
Compilation method and traditional source code package is no different
./configure xxxxx && make && make install

Version after mysql-5.5
After you configure with CMake, you can install



1. Install the Source Configuration tool and the compilation tool
# yum Install cmake gcc gcc-c++-y




2. Establish the identity that the database will run on

General use of MySQL user and MySQL user group


Since the mysql,rpm package that has previously installed the RPM package automatically creates the user and group, if it is not created, it can be created manually

# groupadd-g MySQL
# useradd-s/sbin/nologin-m-G 27-u MySQL



3, unzip the source code and enter the source directory
# tar xvf mysql-5.6.17.tar.gz-c/usr/src/
# cd/usr/src/mysql-5.6.17/


4. Configuration
# CMake. -lah View all supported configuration options
It is recommended to look through the official documentation

# RM./cmakecache.txt If you run the CMake command once, you should delete the file so that the next compilation will be applied to the custom compilation parameters


# CMake. -dcmake_install_prefix=/usr/local/mysql/-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-denabled_ Local_infile=on


5. Compiling and installing
# MAKE-J2
# make Install


# ln-s/usr/local/mysql/bin/*/usr/local/bin/


6. Setting up the configuration file

# VIM/ETC/MY.CNF
[Mysqld]
Datadir=/data
User=mysql
Socket=/data/mysqld.sock
Skip-name-resolve
port=3306
Log-bin=/data/mysqld-bin
Log-bin-index=/data/mysql-bin
Server-id=1

[Mysqld_safe]
Log-error=/data/mysqld.err
Pid-file=/data/mysqld.pid


7. Set up data directory and initialization
# Rm-rf/data
# Mkdir/data

# Cd/usr/local/mysql
#./scripts/mysql_install_db--datadir=/data--user=mysql


8. Start and Change password

Method 1:
Mysqld_safe Script Startup
# Mysqld_safe--DEFAULTS-FILE=/ETC/MY.CNF &

Method 2: Use the source package to bring up the startup script
# CP./SUPPORT-FILES/MYSQL.SERVER/ETC/RC.D/INIT.D/MYSQL5
# chmod 755/ETC/RC.D/INIT.D/MYSQL5
# service MYSQL5 Start

Change Password
# mysqladmin-u root-s/data/mysqld.sock password ' 123 '
# mysqladmin-u root-h 127.0.0.1-p 3306 password ' 123 '

Or
# ln-s/data/mysqld.sock/tmp/mysql.sock
# mysql_secure_installation
# Rm-rf/tmp/mysql.sock

This article from "Linux" blog, declined reprint!

Source compiled MySQL

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.