MySQL Database two: Installation

Source: Internet
Author: User

System environment: CentOS 6.8 64-bit

MySQL version: mysql-5.6.30

MySQL official website: http://www.mysql.com/

Generally speaking, in the formal production environment need to download the GA (Stable) version, the installation directory is usually/usr/local/mysql, and the source is generally downloaded to the/USR/LOCAL/SRC directory, the compilation and installation process is as follows:

One uninstall the default installed version:

Yum List | grep ' MySQL ' confirms whether it is installed by default;

Yum-y Remove MySQL If the installation is uninstalled;


Second install MySQL depends on the library:

Yum-y Groupinstall "Development tools" installation development tools;

Yum-y Install Ncurses-devel ncureses provides character terminal processing libraries, such as panels and menus;


Three create MySQL user and MySQL group: (delete if previous existence)

Groupadd-r MySQL

Useradd-r-m-g mysql-s/sbin/nologin MySQL

Four download and install the Compile tool CMake:

Cd/usr/local/src

wget https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz

TAR-ZXF cmake-3.7.1.tar.gz

CD cmake-3.7.1

./bootstrap

Make && make install


Create a database directory:

Mkdir-pv/usr/local/data can use a single hard disk or a logical volume in a production environment;

Chown-r mysql.mysql/usr/local/data database directory MySQL user needs write permission;


Six install MySQL:

wget http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.30.tar.gz

TAR-ZXF mysql-5.6.30.tar.gz

CD mysql-5.6.30

CMake. -dcmake_install_prefix=/usr/local/mysql \ Specify the installation directory;

-dmysql_datadir=/usr/local/data \ Specify the database directory;

-DSYSCONFDIR=/ETC \ Specify the configuration file directory,

-dwith_innobase_storage_engine=1 \ Open the Database engine

-dwith_archive_storage_engine=1 \ Open the Database engine

-dwith_blackhole_storage_engine=1 \ Open the Database engine

-dwith_ssl=system \ Enable SSL Library support

-dwith_zlib=system \ Support ZLIB Library

-dmysql_unix_addr=/tmp/mysqld.sock \ Sock File location

-DDEFAULT_CHARSET=UTF8 \ Default Character Set

-ddefault_collation=utf8_general_ci Default character Proofing

Make && make install


Seven initialization of the database:

Chown-r Mysql.mysql/usr/local/mysql

./scripts/mysql_install_db--user=mysql--datadir=/usr/local/data


Eight sets MySQL to system service:

cd/usr/local/mysql/support-files/

CP MY-DEFAULT.CNF/ETC/MY.CNF Setup configuration file

CP mysql.server/etc/init.d/mysqld Copy startup script

Chkconfig--add mysqld

Chkconfig--level 345 mysqld on

Service mysqld Start


Nine set the environment variables for MySQL:

VIM/ETC/PROFILE.D/MYSQL.SH Create a new mysql.sh file, add the following path to the file;

"Export path= $PATH:/usr/local/mysql/bin"

. /etc/profile.d/mysql.sh re-reading the configuration file

At this point, MySQL is already installed.


Note: If you install, the following error occurs during the startup process:

Starting MySQL. The server quit without updating PID file ([failed]/mysql/localhost.localdomain.pid).

May be the cause of the following:

1 See if disk space is full;

2 whether the database directory has write permission;

3 by NETSTAT-ANPT | grep ' 3306 ' command to see if the port is occupied or if it is occupied use Killall mysqld to kill the process and release the port;

4 database initialization problems, you can follow the prompts to deal with the corresponding;

Typically, the MySQL error log is a file that is suffixed with. Err in the database directory.

This article from "10,000 years too long, seize" blog, please be sure to keep this source http://zengwj1949.blog.51cto.com/10747365/1880445

MySQL Database two: Installation

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.