Linux centos6.5 under compile and install MySQL

Source: Internet
Author: User
Tags mysql login

Installation Environment

System: centos6.5_86x64

Mysql:mysql-5.6.16.tar.gz

Note: The mysql-5.6.16 installation is different from 5.5, 5.1, and the compilation is no longer used./configure, but compiled using CMake.

1. Create a new directory to hold your data

[Email protected] beauty]# mkdir-p/data/mydata

2. Create a new user

[Email protected] beauty]# groupadd-r MySQL #新建mysql组

[Email protected] beauty]# useradd-g mysql-r-s/sbin/nologin-m-d/mydata/data MySQL #新建mysql用户并加入mysql组

3. Permission settings

[Email protected] beauty]# chown-r mysql:mysql/data/mydata

4. Prepare to install MySQL before compiling

[email protected] ~# Yum install gcc gcc-c++ ncurses-devel perl

[Email protected] ~]# TAR-ZXVF cmake-2.8.10.2.tar.gz

[Email protected] ~]# CD cmake-2.8.10.2

[Email protected] cmake-2.8.10.2]#./bootstrap

[[email protected] cmake-2.8.10.2]# make

[[email protected] cmake-2.8.10.2]# make install

5. Compile and install MySQL

(1) Specify the installation path of the installation file common options:

01.-dcmake_install_prefix=/usr/local/mysql Specifying the installation path

02.-dmysql_datadir=/data/mydata Data Installation path

Installation path of the 03.-DSYSCONFDIR=/ETC configuration file

(2) MySQL default compiled storage engine includes: CSV, MyISAM, MYISAMMRG, and heap. To install additional storage engines, you can use a compilation option similar to the following:

01.-dwith_innobase_storage_engine=1 Installing the Innobase storage engine

02.-dwith_archive_storage_engine=1 Installing the ARCHIVE storage engine

03.-dwith_blackhole_storage_engine=1 Installing the Blackhole storage engine

04.-dwith_federated_storage_engine=1 Installing the Federated Storage Engine

(3) to explicitly specify that a storage engine is not compiled, you can use an option similar to the following:

-dwithout_<engine>_storage_engine=1

01.-dwithout_example_storage_engine=1

02.-dwithout_federated_storage_engine=1

03.-dwithout_partition_storage_engine=1

(4) To compile other features, such as SSL, you can use a library similar to the following to compile or not use a library:

01.-dwith_readline=1

02.-dwith_ssl=system means using the SSL library that comes with the system

03.-dwith_zlib=system

04.-dwith_libwrap=0

(5) Other commonly used options:

01.-dmysql_tcp_port=3306 Setting the default port

02.-dmysql_unix_addr=/tmp/mysql.sock the location of the socket for MySQL interprocess communication

03.-denabled_local_infile=1 whether to start the local local_infile

What additional character sets are supported by 04.-dextra_charsets=all

05.-ddefault_charset=utf8 Default Character Set

06.-ddefault_collation=utf8_general_ci Default Character Set collation

07.-dwith_debug=0 whether to start the DEBUG function

08.-denable_profiling=1 whether the profiling feature is enabled

(6) If you want to clean up the files generated by the previous compilation, you need to use the following command:

Make clean

RM CMakeCache.txt

To start the installation:

[Email protected] beauty]# TAR-ZXVF mysql-5.6.16.tar.gz

[Email protected] beauty]# CD mysql-5.6.16

[Email protected] mysql-5.6.23]# [[email protected] mysql-5.6.16]# 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=/mydata/data-dmysql_tcp_port=3306 \

-denable_downloads=1

[[email protected] mysql-5.6.16]# make

[[email protected] mysql-5.6.16]# make install

[Email protected] mysql-5.6.16]# cd/usr/local/mysql/

[Email protected] mysql]# chown-r mysql:mysql.

[Email protected] mysql]# scripts/mysql_install_db--user=mysql--datadir=/data/mydata #初始化数据库并启动服务器


5. Configuration Files

[Email protected] mysql]# Cd/usr/local/mysql

[email protected] mysql]# CP support-files/my-default.cnf/etc/my.cnf

6. Modify the configuration file

[Email protected] mysql]# VI/ETC/MY.CNF

Thread_concurrency = 2 #找到thread_concurrency的值是你的CPU个数乘以2

DataDir =/mydata/data # Add this line to the file specify where the data file is stored

7. Provide a startup service script for MySQL

[[Email protected] mysql]# [[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld

[Email protected] mysql]# Vi/etc/profile #

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

Export PATH

[Email protected] mysql]# service mysqld start

Starting MySQL ....            success! #启动成功

[Email protected] mysql]# chkconfig--level mysqld on

8. Check if the MYSQLD service is started

[Email protected] mysql]# NETSTAT-TULNP | grep 3306

TCP 0 0::: 3306:::* LISTEN 17668/mysqld

9. Log in to MySQL

[Email protected] mysql]# mysql-u root p #第一次登陆密码是空的

10. Modify MySQL Login password

[Email protected] mysql]# mysqladmin-u root password ' beauty '




This article is from the "Fly Higher" blog, make sure to keep this source http://vqiao.blog.51cto.com/9368913/1621872

Linux centos6.5 under compile and install 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.