Install MySQL 5.6 using the source code in Linux

Source: Internet
Author: User

Install MySQL 5.6 using the source code in Linux

MySQL is an open-source database, so it can be installed based on the source code. Source code-based installation provides more flexibility. That is to say, we can select a suitable compiler for our hardware platform to optimize the compiled binary code and adjust the relevant compilation parameters according to the environment of different software platforms, select different installation components and set the desired character set. You can make various adjustments based on specific application scenarios. This article describes how to install MySQL in the source code mode.

1. installation environment and media
# Installation environment
SZDB :~ # Cat/etc/issue
Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64)-Kernel \ r (\ l ).
SZDB :~ # Uname-
Linux SZDB 2.6.16.60-0.54.5-smp #1 SMP Fri Sep 4 01:28:03 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux

# Install media. You can download the installation media at the following URL. Select source code when downloading. The current version is 5.6.17.
# Download the corresponding installation media according to your own environment, the installation media demonstrated in this article is Generic Linux (Architecture Independent), mysql-5.6.17.tar.gz
Http://dev.mysql.com/downloads/mysql/

# Source code Installation Method official website link: http://dev.mysql.com/doc/refman/5.6/en/installing-source-distribution.html

2. System Requirements
Source Installation System Requirements

Installation of MySQL from source requires several development tools. some of these tools are needed no matter whether you use a standard source distribution or a development source tree. other tool requirements depend on which installation method you use.

To install MySQL from source, your system must have the following tools, regardless of installation method:

CMake, which is used as the build framework on all platforms. CMake can be downloaded from http://www.cmake.org.
A good make program. although some platforms come with their own make implementations, it is highly recommended that you use GNU make 3.75 or newer. it may already be available on your system as gmake. GNU make is available from http://www.gnu.org/software/make.
A working ansi c ++ compiler. GCC 4.2.1 or later, Sun Studio 12 or later, Visual Studio 2010 or later, and merge current vendor-supplied compilers are known to work.
Perl is needed if you intend to run test scripts. Most Unix-like systems include Perl. On Windows, you can use a version such as ActiveState Perl.
# Install the above development tools using the source code. The most important one is the Cmake tool. Generally, the OS is not installed and must be manually installed.
# If no cmake is available, this error message is displayed: (-bash: cmake: command not found)

 

3. Install cmake
# You can download cmake here. Here I download version 2.6.4.
Http://www.cmake.org/cmake/resources/software.html
SZDB :~ # Cd/usr/local/src/mysql_src
SZDB:/usr/local/src/mysql_src # tar-xvf cmake-2.6.4.tar.gz
SZDB:/usr/local/src/mysql_src # cd cmake-2.6.4
SZDB: // usr/local/src/mysql_src/cmake-2.6.4 #./bootstrap
SZDB:/usr/local/src/mysql_src/cmake-2.6.4 #./make
SZDB:/usr/local/src/mysql_src/cmake-2.6.4 #./make install

 

4. Install MySQL
SZDB :~ # Groupadd mysql
SZDB :~ # Useradd-r-g mysql
SZDB :~ # Cd/usr/local/src/mysql_src
SZDB:/usr/local/src/mysql_src # tar-xvf mysql-5.6.17.tar.gz
SZDB:/usr/local/src/mysql_src # ls
Mysql-5.6.17 mysql-5.6.17.tar.gz
SZDB:/usr/local/src/mysql_src # mysql-5.6.17/cd/
SZDB:/usr/local/src/mysql_src/mysql-5.6.17 # cmake.

..........
-- Check size of wint_t-done
-- Cocould NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline. cmake: 85 (MESSAGE): Author: Leshami
Curses library not found. Please install appropriate package, Blog: l
SZDB:/usr/local/src/mysql_src # rpm-Uvh ncurses-devel-5.5-18.11.x86_64.rpm
Preparing... ######################################## ### [100%]
1: ncurses-devel ##################################### ###### [100%]

SZDB:/usr/local/src/mysql_src/mysql-5.6.17 # rm-rf CMakeCache.txt
SZDB:/usr/local/src/mysql_src/mysql-5.6.17 # cmake. # execute cmake again

........
-- Library mysqlserver depends on OSLIBS-lpthread; m; rt; crypt; dl; aio
-- Processing ing done
-- Generating done
-- Build files have been written to:/usr/local/src/mysql_src/mysql-5.6.17

SZDB:/usr/local/src/mysql_src/mysql-5.6.17 # make

Linking CXX executable mysqltest_embedded
[2, 100%] Built target mysqltest_embedded
Scanning dependencies of target my_safe_process
[100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o
Linking CXX executable my_safe_process
[1, 100%] Built target my_safe_process

SZDB:/usr/local/src/mysql_src/mysql-5.6.17 # make install
SZDB:/usr/local/src/mysql_src/mysql-5.6.17 # cd/usr/local/mysql
SZDB:/usr/local/mysql # chown-R mysql.
SZDB:/usr/local/mysql # chgrp-R mysql.
SZDB:/usr/local/mysql # scripts/mysql_install_db -- user = mysql

..........
To start mysqld at boot time you have to copy
Support-files/mysql. server to the right place for your system

Please remember to set a password for the MySQL root USER!
To do so, start the server, then issue the following commands:

./Bin/mysqladmin-u root password 'new-password'
./Bin/mysqladmin-u root-h SZDB password 'new-password'

Alternatively you can run:

./Bin/mysql_secure_installation

Which will also give you the option of removing the test
Databases and anonymous user created by default. This is
Stronugly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon:

Cd ..;./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

Cd mysql-test; perl mysql-test-run.pl

New default config file was created as./my. cnf and
Will be used by default by the server when you start it.
You may edit this file to change server settings
..........

SZDB:/usr/local/mysql # chown-R root.
SZDB:/usr/local/mysql # chown-R mysql data
SZDB:/usr/local/mysql # cp support-files/mysql. server/etc/init. d/mysql. server # configure auto-start
SZDB:/usr/local/mysql # cp support-files/my-default.cnf/etc/my. cnf # Add the default my. cnf configuration file
SZDB:/usr/local/mysql # bin/mysqld_safe -- user = mysql & # Start mysql
[1] 21004
SZDB:/usr/local/mysql #140521 02:54:54 mysqld_safe Logging to '/usr/local/mysql/data/SZDB. err '.
140521 02:54:54 mysqld_safe Starting mysqld daemon with databases from/usr/local/mysql/data

# Configure environment variables by using soft links or modifying environment variables (PATH = $ PATH:/usr/local/mysql/bin/; export PATH)
 
SZDB :~ # Ln-fs/usr/local/mysql/bin/mysql/usr/local/bin
SZDB :~ # Ln-fs/usr/local/mysql/bin/mysqladmin/usr/local/bin
SZDB :~ # Ln-fs/usr/local/mysql/bin/mysqld_safe/usr/local/bin

# Log on to mysql
SZDB:/usr/local/bin # mysql-uroot
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 1
Server version: 5.6.17 Source distribution

Copyright (c) 2000,201 4, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.

Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.

Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Performance_schema |
| Test |
+ -------------------- +
4 rows in set (0.00 sec)

-------------------------------------- Split line --------------------------------------

Compile and install MySQL 5.6.16 in CentOS 6.5

Install MySQL in Ubuntu 14.04

MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

Build a MySQL Master/Slave server in Ubuntu 14.04

Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

-------------------------------------- Split line --------------------------------------

This article permanently updates the link address:

Related Article

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.