Install MySQL in Linux source code

Source: Internet
Author: User

Install MySQL in Linux source code

Today, in Ubuntu and CentOS, MySQL has been installed many times with the source code. Remember to write it down before you forget it.

There is no difference in the installation process in Ubuntu and CentOS.

0. Download the source code and upload it to the server.

1. Prepare cmake and libncurse

Install libncurse with apt-get install cmake and apt-get install libncurse in ubuntu

Use yum-y install ncurses-devel and yum-y install cmake to install CentOS. In some versions, yum-y install cmake28.x86 _ 64 is used.

2. Create a mysql user

Groupadd mysql

Useradd mysql-g mysql-s/sbin/nologin

3. Create the installation directory and authorize

Mkdir-p/usr/local/mysql/data

Chown-R mysql. mysql/usr/local/mysql

4. Unzip and install

Tar zxvf mysql-5.6.16.tar.gz

Cd mysql-5.6.16

Mkdir build # create a build File to separate the source code from the compiled file, making file query easier.

Cd build

Cmake28 ..-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \ # installation directory

-DMYSQL_UNIX_ADDR =/usr/local/mysql. sock \ # socket path used

-DDEFAULT_CHARSET = utf8 \ # specify the default Character Set of the server

-DDEFAULT_COLLATION = utf8_general_ci \ # specify the default server verification rules

-DWITH_EXTRA_CHARSETS: STRING = utf8, gbk \ # install the required Character Set

-DWITH_INNOBASE_STORAGE_ENGINE = 1 \ # InnoDB Engine supported

-DWITH_READLINE = 1 \

-DENABLED_LOCAL_INFILE = 1 \ # specify whether local load data infile execution is allowed

-DMYSQL_DATADIR =/usr/local/mysql/data/\ # data storage location

-DMYSQL_TCP_PORT = 3306 # default port

Make & make install

5. Add the mysql configuration file to/etc /.

Cp support-files/my-small.cnf/etc/my. cnf # mysql configuration file

Chmod 755 scripts/mysql_install_db # execution permission

Scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data/# Initialization

Cp support-files/mysql. server/etc/init. d/mysqld # start the program

Chmod 755/etc/init. d/mysqld # execution permission

6. Start the service

Service mysqld start

7. Add a password

/Usr/local/mysql/bin/mysqladmin-u root password 'passwd'

Install MySQL on Ubuntu source code for problem solving and Security Optimization

Install MySQL on CentOS source code and solve the problem and optimize the security.

Install MySQL 5.6 with the source code in CentOS 7

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

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.