Centos7.1 for MySQL5.6.30 source installation

Source: Internet
Author: User

Preparatory work:

os:centos7.1

Database:mysql-5.6.30.tar.gz

1. Create a MySQL account

Create users and user groups

[Email protected] ~]# groupadd MySQL [[email protected] ~]# useradd-g mysql mysql [[email protected] ~]# passwd my Sql

2. Verifying the installation package

before verifying whether MySQL was installed before , if there is a MySQL related package, then rpm-e one by one (it is recommended to delete the Devel package, then the MySQL package, and finally forcibly delete the Libs package)

[[email protected] ~]# rpm-qa|grep MySQL

Verify that the following compilation prerequisite installation packages are installed:

Gcc*,gcc-c++*,cmake,autoconf*,automake*,zlib*,ncurses-devel*,libtool*,bison

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/84/1B/wKiom1eF0Y-DRDgNAACpVNxcfKc895.jpg-wh_500x0-wm_3 -wmp_4-s_3305338348.jpg "title=" 1.JPG "alt=" Wkiom1ef0y-drdgnaacpvnxcfkc895.jpg-wh_50 "/>

When a related installation package is missing, it needs to be installed via RPM-IVH ***.rpm or yum install Rpm_name

3. Source code Compilation process

  [[email protected] mysql-5.6]# cmake .        -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6   #安装目录        - dwith_innobase_storage_engine=1    #支持InnoDB引擎        - dwith-readline=1  #支持快捷键        -DEXTRA_CHARSETS=all   #安装所有字符集        -DENABLED_LOCAL_INFILE=1   #从本地导入数据         -DWITH_EMBEDDED_SERVER=1  #编译Embedded  mysql Library         -DWITH_SSL=bundled  #       -DDEFAULT_CHARSET=utf8      #默认字符集   [[email protected] mysql-5.6]# make  [[email  protected] mysql-5.6]# make install  [[email protected] mysql-5.6]#  ln -s /usr/local/mySql-5.6 /usr/local/mysql 


4. Create MySQL data directory and/ETC/MY.CNF

data storage directory, default to Basedir under the data directory (the actual scenario, the proposed mount dedicated disk as data):

  [[email protected] mysql-5.6]# cd /usr/local/mysql  [[email  protected]  mysql]#  mkdir -p /opt/mysql/data1  [[email protected ]  mysql]#  chown -r mysql.mysql /opt/mysql    [[email  protected]  mysql]# vi /etc/my.cnf[client]port = 3306socket =/opt/ mysql/data1/mysqld.sock[mysqld_safe]user = mysqlnice = 0[mysqld]port =  3306pid-file = /opt/mysql/data1/mysqld.pidsocket = /opt/mysql/data1/mysqld.sockbasedir  = /usr/local/mysqldatadir = /opt/mysql/data1/tmpdir = /opt/mysql/data1/ log-error = /opt/mysql/data1/mysqld.logslow_query_log =1slow_query_log_file = /opt/ Mysql/data1/mysql-slow.loglog_bin = /opt/mysql/data1/mysql-bin.log[mysqldump]quickquote-namesmax_ Allowed_packet = 16mdefault-charaCter-set = utf8[mysql]default-character-set = utf8 

4. Initialize MySQL

It is recommended that you enter the/usr/local/mysql directory and initialize it in the following way, or you may get an error

[Email protected] mysql]#/scripts/mysql_install_db--defaults-file=/etc/my.cnf [[email protected] mysql]#./bin/m Ysql_secure_installation

5. Add MySQL service to INIT.D management

It is recommended that you enter the/usr/local/mysql directory and initialize it in the following way, or you may get an error

[Email protected] mysql]# cp/bin/mysql.service/etc/init.d/mysql [[email protected] mysql]# chkconfig--add MySQL [[email protected] mysql]# chkconfig mysql on [[email protected] mysql]# chkconfig--list

At the same time VI ~/.bash_profile, after the path variable is added:/usr/local/mysql/bin

6. Several ways to start the MySQL service

The difference between mysqld and Mysqld_safe is that the mysqld_safe can still be restarted after the outage.

[[Email protected] mysql]# service MySQL start
[Email protected] mysql]# Mysqld_safe--defaults-file=/etc/my.cnf &
[Email protected] mysql]# mysqld--DEFAULTS-FILE=/ETC/MY.CNF &


This article is from the "Big Waste" blog, please be sure to keep this source http://bigtrash.blog.51cto.com/8966424/1826058

Centos7.1 for MySQL5.6.30 source installation

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.