Linux MySQL compilation installation (1)

Source: Internet
Author: User

centos6.6 Compiling and installing MySQL5.6


"The content described in this document is intended for common MySQL database environment deployments such as company testing/production"

One: Prepare for the environment before deployment:

1.1 Related software and systems

System Requirements: Centos 6.6 (64-bit)

Related middleware: mysql-5.6.23

1.2 Related system dependent package installation Check preparation

1.2.1 Check if the system comes with MySQL installation

# Rpm-qa | grep MySQL

If you have an installation, use the following command to uninstall the program

# yum Remove MySQL

1.2.2 Installation System-related compilation environment: the dependency package required before MySQL compilation

Yum install gcc gcc-c++ cmake autoconf automake ncurses-devel libmcrypt* libtool* zlib* libxml* OpenSSL openssl-devel

Two: MySQL environment deployment official installation:

2.1 Compiling and installing MySQL

MySQL from 5.5 version starts with the ./configure The compile configuration method has been canceled and replaced by CMake Tool compilation.

Therefore, we first need to compile and install the source code in the system CMake Tools, install CMake can be installed in the source code can also be Yum installation, the use of the Yum form installed CMake

2.1.1 MySQL pre-installation (need to add the relevant MySQL running account and related installation directory and permissions before installing MySQL)

<--add MySQL Run account--

# Groupadd MySQL//Add MySQL Service group account # useradd-g mysql-m-s/sbin/nologin mysql//Add MySQL service account, set No landing system;

<--adding MySQL program-related directories--

# mkdir-p/usr/local/mysql//create MySQL installation directory; # mkdir-p/usr/local/mysql/data//create MySQL data storage directory;
2.1.2 Compiling and installing MySQL(the default package is placed in the/root directory, the package is extracted uniformly to/usr/local/src)

# tar -zxvf mysql-5.6.23.tar.gz -c /usr/local/src/#  cd /usr/local/src/mysql-5.6.23/# cmake  -dcmake_install_prefix=/usr/local/mysql   -dmysql_unix_addr=/tmp/mysql.sock  -ddefault_charset=utf8  -ddefault_collation =utf8_general_ci  -dextra_charsets=all  -dwith_myisam_storage_engine=1  -dwith_ Innobase_storage_engine=1  -dwith_archive_storage_engine=1  -dwith_blackhole_storage_ engine=1  -dwith_memory_storage_engine=1  -dwith_federated_storage_engine=1  - dwith_readline=1  -denabled_local_infile=1  -dmysql_datadir=/usr/local/mysql/data   -dmysql_user=mysql  -dmysql_tcp_port=3306  -dsysconfdir=/etc  -dwith_ssl= Yes# make && make install 

Tip: If the compilation fails, recompile requires the following command, and clears the relevant file, as follows:

# Make clean# rm-f CMakeCache.txt

2.1.3 to the MySQL related directory to set the owner permission

# Chown-r Mysql:mysql/usr/local/mysql//Set MySQL installation directory owner; # chown-r Mysql:mysql/usr/local/mysql/data//set MySQL data storage The owner of the catalogue;

2.1.4 Initializing MySQL Database preparation

# cd/usr/local/mysql///The owner of the MySQL installation directory is set up; # scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/ Mysql/data--user=mysql//initialize MySQL database;

2.1.5 Adding a MySQL database profile template

# cd/usr/local/mysql///Enter into the installation directory Copy database sample template; # CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF//This sample template can be Production can also be developed;

2.1.6 add MySQL service to boot into system service and optimize MySQL command call

<--add MySQL service boot to system service and boot from boot-up

# cd /usr/local/mysql/# cp support-files/mysql.server  /etc/init.d/mysqld  //Copy the MySQL service script to the system;# vim /etc/init.d/mysqld  find the following and add the relevant path   basedir=/usr/local/mysql              //mysql installation directory;   datadir=/usr/lcoal/mysql/data        // MySQL Data storage directory;# chkconfig -add mysqld                  //add MySQL service to system service; # chkconfig --level 235 mysqld  on      //set MySQL boot from start; 

<-- optimized mysql command call --

Modify the/etc/profile file to add at the end of the file

# Path=/usr/local/mysql/bin: $PATH # export path# wq! Save # Source/etc/profile

2.1.7 start the MySQL service and set the Administrator account password

# service mysqld start         //starting MySQL database service #  mysql_secure_installation    //security settings for MySQL (including database password and associated library permission settings) <------- Omitted here--------->   //here is a post-run related cue message enter current password for root  ( Enter for none):  ok, successfully used password, moving on ... setting the root password ensures that nobody can log into  The mysqlroot user without the proper authorisation. you already have a root password set, so you can safely  answer  ' n '. change the root password? [y/n] y                (set MySQL administrator root password) New password: re-enter new password:  password updated successfully! ReloadIng privilege tables.  ... success! remove anonymous users? [y/n] y                  (Remove anonymous user, select y)      ... Success!<----- --Omit---------here >Disallow root login remotely? [Y/n] y            (remove administrator remote access, select y)  ... Success!<-------omit---------here >remove  test database and access to it? [Y/n] y  (remove Test database, select Y) <--- ----omitted here--------->Reload privilege tables now? [Y/n] y             (Refresh database permissions, select y)  ... success! Cleaning up ...
Three: Test whether the database is working properly
# Mysql-uroot-penter Password:welcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 29269Server version:5.5.43-log Source distributioncopyright (c), Oracle and/ or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql>

See these tips to show that MySQL is running properly, MySQL environment compiled installation ok!


CentOS 6.4 Under compile install MySQL 5.6.14



This article is from the "Rookie Growth" blog, please be sure to keep this source http://blief.blog.51cto.com/6170059/1671119

Linux MySQL compilation installation (1)

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.