Mysql Linux Installation Documentation

Source: Internet
Author: User

1. Install dependent packages

Yum-y Install gcc-c++ ncurses-devel cmake make perl gcc autoconf automake zlib libxml libgcrypt libtool Bison

2. Install the Boost library:

First, check whether the boost has been installed

Rpm-qa boost*

Uninstall old boost-* and other libraries:

Yum-y Remove boost-*

Download the BOOST library, copy it to the/usr/local/boost directory after decompression, and then re-cmake and add options to the following options-dwith_boost=/usr/local/boost

(Download: http://sourceforge.net/projects/boost/files/boost/)

Note: mysql5.7.10 requires a boost version of 1.59.0 cannot be another version

: http://liquidtelecom.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

3. Download MySQL source code

Official website: http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.10.tar.gz

Unzip after download

4. Installation process

(1) Create user, group

# Groupadd MySQL

# Mkdir/home/mysql #自定义位置

# Mkdir/home/mysql/data #自定义位置

# useradd-g mysql-d/home/mysql MySQL

(2) Compiling MySQL

Cmake-dcmake_install_prefix=/home/mysql-dmysql_datadir=/home/mysql/data-ddefault_charset=utf8-ddefault_ Collation=utf8_general_ci-dmysql_tcp_port=3306-dmysql_user=mysql-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 -ddownload_boost=1-dwith_boost=/usr/local/boost

(3) Installation

The second step is not an error.

Make && make install

(4) Initializing the database

Enter the bin directory under the installation record to perform

./mysqld--initialize--user=mysql--basedir=/home/mysql--datadir=/home/mysql/data

Note: The default password is generated after initialization, please log it down

(5) Adjust configuration file and environment variable parameters

MY.CNF backup that will be generated by default

# Mv/etc/my.cnf/etc/my.cnf.bak

Access to MySQL installation directory support file directory

# Cd/mysql/support-files

Copy the profile template to the new MySQL configuration file,

# CP MY-DEFAULT.CNF/ETC/MY.CNF

You can modify the new profile options as needed, without modifying the configuration options, and MySQL runs on the default configuration parameters.

as follows, I modify the configuration file/etc/my.cnf, which is used to set the encoding to UTF8 to prevent garbled

[Mysqld]

Character_set_server=utf8

init_connect= ' SET NAMES UTF8 '

[Client]

Default-character-set=utf8

Copy the startup script to Init.d

Cp/mysql/support-files/mysql.server/etc/init.d/mysqld

Increase execution permissions

chmod 755/etc/init.d/mysqld

Create a MySQL command file

Ln-s/mysql/bin/mysql/usr/bin/

Note: There is no MySQL command without this file and you cannot access the database in any location using MySQL

(6) Start MySQL

Service mysqld Start

(7) Accessing the database

Mysql-uroot-p

Password is the password you just generated

(8) Modify the default password

Alter user ' root ' @ ' localhost ' identified by ' 123456 ';

Note: Without modifying the default password, SQL will not work properly and must be modified

Here, mysql5.7.10 installation is complete.

Error Record:

CMake compile, you may encounter the Boost library error, cause analysis: May be downloaded boost version inconsistent with the MySQL requirements version, the boost version must be MySQL specified version, below or above the specified version is not available.

Mysql Linux Installation Documentation

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.