Linux compilation install MySQL 5.6

Source: Internet
Author: User

Installation environment: Centos 6.8,mysql 5.6.23

First, compile and install the pre-MySQL preparation work

Install the tools and libraries needed to compile the source code

Yum-y install gcc gcc-c++ ncurses-devel perl openssl-devel Bison

Install cmake (remember that you need to cmake compile the installation from MySQL 5.5), from download in https://cmake.org/download/.

Tar zxvfcmake-3.4.1.tar.gzcd cmake-3.4.1./bootstrapmake && make install

Second, create the user and MySQL required directory

New MySQL User

Groupadd-r mysqluseradd-r-G MySQL MySQL

New MySQL Required Directory

Mkdir-p/usr/local/mysql mkdir-p/data/mysqldb

Database file directory creation can be referenced http://zhoufan.blog.51cto.com/4278592/1790308 create LVM and Mount.

Third, compile and install MySQL

MySQL source code can be downloaded from http://dev.mysql.com/downloads/mysql/.

Tar zxvf mysql-5.6.23.tar.gzcd Mysql-5.6.23cmake-dcmake_install_prefix=/usr/local/mysql-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=/data/mysqldb-dmysql_tcp_port=3306-denable_downloads=1-dsysconfdir=/ Etc\-dwith_ssl=system-dwith_zlib=system\-dwith_libwrap=0make&& make install


-dcmake_install_prefix=dir_name Setting up the MySQL installation directory
-ddefault_charset=charset_name Sets the character set of the server. By default, MySQL uses the latin1 (CP1252 Western European) character set
-ddefault_collation=collation_name Sets the collation of the server.

-dwith_innobase_storage_engine=1

-dwith_archive_storage_engine=1 

-dwith_blackhole_storage_engine=1

storage engine options: Myisam,merge,memory, and the CSV engine are compiled to the server by default and do not need to be explicitly installed.
-dmysql_datadir=dir_name Set the MySQL database file directory
-dsysconfdir Setting the MY.CNF location

Modify MySQL directory permissions

Cd/usr/local/mysql chown-r mysql:mysql. Cd/data/mysqldb chown-r mysql:mysql.

Initializing MySQL Database

Cd/usr/local/mysqlscripts/mysql_install_db--user=mysql--datadir=/data/mysqldb

Edit MySQL configuration file

Mv/etc/my.cnf/etc/my.cnf.bak

edit my.cnf, MY.CNF can be generated in the Percona website and in accordance with their own circumstances. The URL is as follows: https://tools.percona.com/ Wizard  .

[mysql]# client  #port                             = 3306socket                           = /data/mysqldb/mysql.sock[mysqld]# GENERAL  #user                              = mysqldefault-storage-engine          = InnoDBsocket                          = /data/mysqldb /mysql.sockpid-file                        = /data/mysqldb/mysql.pid# myisam  #key-buffer-size                 = 32Mmyisam-recover                  = force,backup#  SAFETY  #max-allowed-packet              = 16Mmax-connect-errors              = 1000000# DATA STORAGE  #datadir                          = /data/ mysqldb/# binary logging  #log-bin                         = /data/mysqldb/ mysql-binexpire-logs-days                = 14sync-binlog                      = 1# REPLICATION  #skip-slave-start                = 1relay-log                       = /data/mysqldb/ relay-binslave-net-timeout               = 60# caches and limits  #tmp-table-size                  = 32Mmax-heap-table-size             = 32Mquery-cache-type                = 0query-cache-size                = 0max-connections                 = 500thread-cache-size               = 50open-files-limit                = 65535table-definition-cache          = 4096table-open-cache                = 4096# INNODB  #innodb-flush-method             = o_directinnodb-log-files-in-group       = 2innodb-log-file-size            = 64minnodb-flush-log-at-trx-commit = 1innodb-file-per-table           = 1innodb-buffer-pool-size        = 592M#  logging  #log-error                       = /data/mysqldb/ mysql-error.loglog-queries-not-using-indexes  = 1slow-query-log                  = 1slow-query-log-file             = /data/mysqldb/mysql-slow.log

Copy the MySQL boot file and its commands join path

CP Support-files/mysql.server/etc/init.d/mysqld vim/etc/profile.d/mysql.sh path=/usr/local/mysql/bin:/usr/local/ Mysql/lib: $PATH Export pathsource/etc/profile.d/mysql.sh

Start MySQL and add startup items

Service mysqld start Chkconfig mysqld on

Set MySQL login permissions

Drop user ' @localhost;d rop user ' @hostname; update mysql.user set Password=password (' ******* '); flush privileges;

At this point, the MySQL compilation installation is complete.


This article is from the "Frank" blog, so be sure to keep this source http://zhoufan.blog.51cto.com/4278592/1790330

Linux compilation install MySQL 5.6

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.