MySQL installation (source installation mode)

Source: Internet
Author: User

MySQL installation (RPM installation mode) and directory structure

MySQL installation (binary installation mode)

MySQL installation (source installation mode)



This article uses the MySQL source code to install, is slightly more troublesome.

CentOS Release 5.11+ mysql-5.6.22


Using source code compilation, you need to download a tool CMake:

What ' s Cmake? The official notes are as follows:

CMake is a family of the tools designed tobuild, test and package software. CMake is used to control the software compilationprocess using simple platform and compiler independent configuration file S.cmake generates native makefiles and workspaces that can is used in thecompiler environment of your choice.

CMake official:http://www.cmake.org/download/


CMake version of this test installation:

Release candidate (3.2.0-RC2)-source distributions-unix/linux Source (has \ line feeds)-cmake-3.2.0-rc2.tar.gz


CMake Decompression:

Ll/usr/local/src/cmake-3.2.0-rc2.tar.gz

Tar zxvfcmake-3.2.0-rc2.tar.gz

Mv/usr/local/src/cmake-3.2.0-rc2/usr/local/cmake


Compile and install:

cd/usr/local/cmake/

./configure


#configure完成后提示: Now run Gmake, then execute gmake

Gmake

Make

Make install


install MySQL, official reference: Installing MySQL Using a standard Source distribution


Create MySQL users and groups first:

Groupadd MySQL

Useradd-r-G MySQL MySQL


MySQL Current instance: (size 30M)

http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.6/MySQL-5.6.22-1.linux_glibc2.5.src.rpm


Unpack the RPM package:

MV Mysql-5.6.22-1.linux_glibc2.5.src.rpm/usr/local/src

rpm2cpiomysql-5.6.22-1.linux_glibc2.5.src.rpm | Cpio-div


Tar zxvf mysql-5.6.22.tar.gz

Mv/usr/local/src/mysql-5.6.22/usr/local/mysql


compile MySQL: (5.5 version (inclusive) use cmake,5.1./configure)

Cd/usr/local/mysql

CMake.-dcmake_install_prefix=/usr/local/mysql \

-dmysql_datadir=/usr/local/mysql/data\

-dmysql_tcp_port=3306 \

-DSYSCONFDIR=/ETC \

-dextra_charsets=all \

-ddefault_charset=utf8 \

-ddefault_collation=utf8_general_ci\

-denabled_local_infile=1 \

-dwith_innobase_storage_engine=1\

-dwith_archive_storage_engine=1\

-dwith_blackhole_storage_engine=1\

-dwith_perfschema_storage_engine=1

#以上配置参数更多参考: MySQL source-configuration Options

Make

Make install


To set the root directory owner:

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


Copy the service and configuration file into the system configuration file:

Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld

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


Edit the MySQL configuration file to add the following parameters: VI/ETC/MY.CNF

[Mysqld]

Basedir =/usr/local/mysql

Datadir=/usr/local/mysql/data

Port = 3306

server_id = 1


Initialize the database:

chmod 755/usr/local/mysql/scripts/mysql_install_db

/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data


Set Boot mysqld service:

Chkconfig mysqld on


Setting Environment variables: vi/root/.bash_profile

#PATH = $PATH: $HOME/bin

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


[Email protected] ~]# Source/root/.bash_profile


To start the MYSQLD service:

chmod 755/etc/init.d/mysqld

/etc/init.d/mysqld start

Service mysqld Restart



Set MySQL password and related settings:

/usr/local/mysql/bin/mysql_secure_installation

Complete!! Login successfully!




Installation is complete, first fill the water.


MySQL installation (source installation mode)

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.