Install MySQL 5.6.12 (cmake compilation) in Linux source code)

Source: Internet
Author: User

1. Install the make Compiler (default system)

: Http://www.gnu.org/software/make/

[C-sharp]
View plaincopyprint?
  1. Tar zxvf make-3.82.tar.gz
  2. CD make-3.82
  3. ./Configure
  4. Make
  5. Make install

Tar zxvf make-3.82.tar.gz <br/> Cd make-3.82 <br/>./configure <br/> make install

2. Install BISON (it is best to install all the base software before compiling lamp)

: Http://www.gnu.org/software/bison/

[C-sharp]
View plaincopyprint?
  1. Tar zxvf bison-2.5.tar.gz
  2. CD bison-2.5
  3. ./Configure
  4. Make
  5. Make install

Tar zxvf bison-2.5.tar.gz <br/> Cd bison-2.5 <br/>./configure <br/> make install

3. Install gcc-C ++

: Http://www.gnu.org/software/gcc/

[C-sharp]
View plaincopyprint?
  1. Tar zxvf gcc-c00000000-4.4.4.tar.gz
  2. CD gcc-C ++-4.4.4
  3. ./Configure
  4. Make
  5. Make install

Tar zxvf gcc-c00000000-4.4.tar.gz <br/> Cd gcc-C ++-4.4.4.4 <br/>./configure <br/> make install

4. Install cmake (Please download the latest version for installation)

: Http://www.cmake.org/

[C-sharp]
View plaincopyprint?
  1. Tar zxvf cmake-2.8.4.tar.gz
  2. CD cmake-2.8.4
  3. ./Configure
  4. Make
  5. Make install

Tar zxvf cmake-2.8.4.tar.gz <br/> Cd cmake-2.8.4 <br/>./configure <br/> make install

5. Install ncurses

: Http://www.gnu.org/software/ncurses/

[C-sharp]
View plaincopyprint?
  1. Tar zxvf ncurses-5.8.tar.gz
  2. CD ncurses-5.8
  3. ./Configure
  4. Make
  5. Make install

Tar zxvf ncurses-5.8.tar.gz <br/> Cd ncurses-5.8 <br/>./configure <br/> make install

 

Start installing MySQL,: http://dev.mysql.com/

Here I download mysql-5.6.12.tar.gz

Ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.6/

Preparations

[C-sharp]
View plaincopyprint?
  1. Groupadd MySQL
  2. Useradd mysql-G mysql-m-S/sbin/nologin
    # Add a user named centos MySQL.

    -G: Specifies the user group to which the new user belongs)

    -M: do not create a root directory

    -S: defines the shell it uses./sbin/nologin indicates that the user cannot log on.System.

Groupadd mysql <br/> useradd-r-g MySQL

Decompress and install MySQL

[C-sharp]
View plaincopyprint?
  1. Tar zxvf mysql-5.6.12.tar.gz
  2. CD mysql-5.6.12 (below is a line here for your understanding and comments written into line feed comments, in actual compilation please add "\" link before line feed) cmake \
    -Dcmake_install_prefix =/usr/local/MySQL \ # installation path
    -Dmysql_datadir =/usr/local/MySQL/data \ # data file storage location
    -Dsysconfdir =/etc \ # My. CNF path
    -Dwith_myisam_storage_engine = 1 \ # support for the myiasm Engine
    -Dwith_innobase_storage_engine = 1 \ # InnoDB Engine supported
    -Dwith_memory_storage_engine = 1 \ # support for the memory Engine
    -Dwith_readline = 1 \ # shortcut key function (I have never used it)
    -Dmysql_unix_addr =/tmp/mysqld. Sock \ # connect to the database socket path
    -Dmysql_tcp_port = 3306 \ # Port
    -Denabled_local_infile = 1 \ # Allow Local Data Import
    -Dwith_partition_storage_engine = 1 \ # Database partitions supported for Installation
    -Dextra_charsets = all \ # Install all character sets
    -Ddefault_charset = utf8 \ # default character
    -Ddefault_collation = utf8_general_ci

  3. Make
  4. Make install

After completion, continue the following operations

[C-sharp]
View plaincopyprint?
  1. CD/usr/local/MySQL
  2. Chown-r MYSQL: mysql. (modify the permission to the root user after the installation is complete)
  3. Scripts/mysql_install_db -- user = MySQL (perform the following permission modification first)
  4. Chown-r root: MySQL. (set the permission to the root user and the MySQL group to cancel the read and write permissions of other users. Only the read and write permissions of MySQL "RX" are granted. Other users do not have any permissions)
  5. Chown-r MYSQL: MySQL. /data (set the database directory to the MySQL user MySQL group, and grant the CHMOD-r ug + rwx read and write execution permission to the database. All other user permissions are deleted and only the MySQL user permission is granted)

CD/usr/local/MySQL <br/> chown-r MySQL. <br/> chgrp-r MySQL. <br/> scripts/mysql_install_db -- user = mysql <br/> chown-r root.

The following command is optional. Copy the MySQL configuration file to/etc.

[C-sharp]
View plaincopyprint?
  1. CP support-files/my-medium.cnf/etc/My. CNF (the original old version is this operation, 5.6.12 is the following file address)
  2. CP support-files/my-default.cnf/etc/My. CNF (and to/etc/My. the CNF + x permission deletes write permissions of other users at the same time, and only the root and workgroup RX permissions are granted. All other permissions are deleted even the RX permissions)

CP support-files/my-medium.cnf/etc/My. CNF


# Modify my. CNF Configuration
Vim/etc/My. CNF

# [Mysqld] Add:
Datadir =/data/MySQL
Default-storage-engine = MyISAM


Start MYSQL:

[C-sharp]
View plaincopyprint?
  1. Bin/mysqld_safe -- user = MySQL &
  2. # Start MySQL to check whether it is successful
  3. Netstat-tnl | grep 3306

Bin/mysqld_safe -- user = MySQL & <br/> # Start MySQL and check whether it is successful <br/> netstat-tnl | grep 3306

The above is a method to start MySQL, there is a simple and convenient, as follows:

[C-sharp]
View plaincopyprint?
  1. # Add the MySQL startup service to the System Service
  2. CP support-files/MySQL. Server/etc/init. d/MySQL
  3. # Run the following command to start MYSQL:
  4. Service MySQL start
  5. # Stopping the MySQL Service
  6. Service MySQL stop
  7. # Restart the MySQL Service
  8. Service MySQL restart

# Add the MySQL startup service to the System Service <br/> CP support-files/MySQL. server/etc/init. d/MySQL. server <br/> # Run the following command to start mysql <br/> service MySQL. server start <br/> # Stop MySQL service <br/> service MySQL. server stop <br/> # restart MySQL service <br/> service MySQL. server restart

Add the MySQL service to the startup Item to enable the MySQL service to start up.

[C-sharp]
View plaincopyprint?
  1. Chkconfig -- add MySQL

Change the default root account password. The default password is blank.

Change the password CD to the MySQL directory

CD/usr/local/MySQL

#./Bin/mysqladmin-u Root Password

Press enter to set a new password ..

# Start MySQL
/Usr/local/MySQL/bin/mysqld_safe-defaults-file =/etc/My. CNF &
# Or
/Etc/init. d/MySQL start (Service MySQL start)

# Test whether MySQL is started
#1) check whether a MySQL process exists
PS-Ef | grep MySQL
#2) check whether the port is running
Netstat-tnl | grep 3306
#3) read MySQL version information
Mysqladmin version

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.