Compile and install MySQL 5.6.23 in Ubuntu 14.10

Source: Internet
Author: User

Compile and install MySQL 5.6.23 in Ubuntu 14.10

1. installation environment:
Ubuntu Server 14.10
MySQL-5.6.23.tar.gz

2. install necessary tools
Sudo apt-get install make bison g ++ build-essential libncurses5-dev cmake

3. Add a combined user to set the installation directory permission
Sudo groupadd mysql
Sudo useradd-g mysql-s/bin/false # create a user mysql and add it to the mysql group. mysql users are not allowed to log on to the system directly.
Sudo mkdir-p/usr/local/mysql # create the Mysql installation directory
Sudo mkdir-p/usr/local/mysql/data
Sudo mkdir-p/usr/local/mysql/log
Sudo chown-R mysql: mysql/usr/local/mysql/data
Sudo chown-R mysql: mysql/usr/local/mysql

4. Compile and install mysql

4.1 get source code package
Cd/usr/local/src
Sudo wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.23.tar.gz

4.2 decompress the mysql source code package
Sudo tar-zxvf mysql-5.6.23.tar.gz

5. Compile the configuration
Cd mysql-5.6.23
Sudo cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DSYSCONFDIR =/etc-DMYSQL_UNIX_ADDR =/tmp/mysql. sock-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DEXTRA_CHARSETS = all-rows = 1-rows = 1-rows = 1-DWITH_READLINE = 1-rows = 1-rows =/usr/local /mysql/data-DMYSQL_USER = mysql-DWITH_DEBUG = 0


Note:
During re-compilation, you need to clear the old object file and cache information.
# Make clean
# Rm-f CMakeCache.txt
# Rm-rf/etc/my. cnf
Sudo make-j4 #-j: Run with multiple cores
Sudo make install
6. Related Configuration
6.1 configure startup
Sudo chmod + w/usr/local/mysql
Sudo cp./support-files/my-default.cnf/etc/my. cnf
Sudo cp./support-files/mysql. server/etc/init. d/mysqld
Sudo chmod 755/etc/init. d/mysqld

6.2 set environment variables for soft connections with Common commands
Sudo ln-s/usr/local/mysql/lib/libmysqlclient. so.18/usr/lib/libmysqlclient. so.18
Sudo ln-s/usr/local/mysql/bin/mysql/usr/bin
Sudo ln-s/usr/local/mysql/bin/mysqladmin/usr/bin

6.3 initialize the database

Sudo/usr/local/mysql/scripts/mysql_install_db -- defaults-file =/etc/my. cnf -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data -- user = mysql

7. Start mysql service for a try
Sudo/etc/init. d/mysqld start

8. Create a password for the root user after the startup is successful.
Mysqladmin-u root password

9. Use
Mysql-uroot-p

Note:
I put the installation path under/usr/local/mysql, that is, the default path, and data under/usr/local/mysql/data, put the sock file in/usr/local/mysql/mysqld. sock
Some parameters are as follows: select as needed.
CMAKE_INSTALL_PREFIX: Specifies the installation directory of the MySQL program. The default value is/usr/local/mysql.
DEFAULT_CHARSET: Specifies the default Character Set of the server. The default value is latin1.
DEFAULT_COLLATION: Specifies the default server verification rules. The default value is latin1_general_ci.
ENABLED_LOCAL_INFILE: Specifies whether local load data infile execution is allowed. The default value is OFF.
WITH_COMMENT: Specifies the compilation remarks.
WITH_xxx_STORAGE_ENGINE: it specifies the storage engine for static compilation to mysql. By default, four engines, MyISAM, MERGE, MEMBER, and CSV, are compiled to the server, and do not need to be specified.
WITHOUT_xxx_STORAGE_ENGINE: Specifies the storage engine that is not compiled.
SYSCONFDIR: directory of the initialization parameter file
MYSQL_DATADIR: data file directory
MYSQL_TCP_PORT: Service port number. The default value is 3306.
MYSQL_UNIX_ADDR: socket file path. Default Value:/tmp/mysql. sock

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

How to install and configure MySQL5.7.3.0

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

MySQL-5.5.38 universal binary Installation

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

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.