MySQL is a relational database management system, developed by Sweden’s MySQL AB, which is a product of Oracle. MySQL is one of the most popular Relational Database Management systems. In terms of Web application, MySQL is one of the best RDBMS applications. MySQL is a relational database management system that keeps data in separate tables rather than in one large repository, which increases speed and flexibility. The SQL language used by MySQL is the most commonly used standardized language for accessing databases. MySQL software adopts a dual licensing policy, which is divided into community version and commercial version. Due to its small size, fast speed and low overall ownership cost, especially the characteristics of open source, MySQL is generally chosen as the website database for the development of small and medium-sized websites.


The target

  • Mysql > configure mysql from CentOS7;
  • Familiar with MySQL stand-alone installation;

The environment

  • CentOS7
  • Mysql – 5.7.21 – Linux – glibc2.12 – x86_64. Tar. Gz
  • VMware

Depend on the package

yum -y install gcc-c++ ncurses-devel cmake make perl gcc autoconf automake zlib libxml libgcrypt libtool bison


  • Download directory: /mysoft
  • /usr/local/mysql
  • Database to store location: / usr/local/fileData/mysqlData
  • Log saved location: / usr/local/fileLogs/logMysql
  • User group: MySQL
  • Users: mysql

Create user groups and users

Cat/etc/passwd / / to view the user and group information: view the list of users cat/etc/group / / view the user group list to check whether there is a cat/etc/mysql group and user group | grep groupadd mysql to create user groups Mysql > create user useradd-r-g mysql-s /bin/false mysql or useradd-r-g mysql-l

Install Dmysql

  • Unzip the installation package

    The tar ZXVF mysql - 5.7.21 - Linux - glibc2.12 - x86_64. Tar. Gz
  • Enter the directory

    CD/mysoft/mysql - 5.7.21 - Linux - glibc2.12 - x86_64
  • Move and change the name to MySQL

    Mysql - 5.7.21 - Linux - mv glibc2.12 x86_64 / usr/local/mysql

The configuration file

  • Copy the my. CNF configuration file to /etc/

    vim /etc/my.cnf
  • Modify the my.cnf configuration file

Modify directory permissions

Go to /usr/local/filedata

Go to /usr/local

chown -R mysql:mysql mysqlData

chown -R mysql:mysql mysql

Initialize the

A random password will be generated after initialization. The need to save it. / mysqld -- -- the initialize - user = mysql - basedir = / usr/local/mysql - datadir = / usr/local/fileData/mysqlData
** Operation command **

Mysql /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

Open account, close, restart

service mysql start

service mysql stop

service mysql restart

Create soft links to facilitate command-line connections

cp /usr/local/mysql/bin/mysql /usr/bin/mysql