Install mysql5.7.11 and centos7mysql5.7.11 on the source code of centos 7.

Source: Internet
Author: User

Install mysql5.7.11 and centos7mysql5.7.11 on the source code of centos 7.

As a beginner, it took three days to install this device, and various errors were difficult to solve, and various answers on the Internet were misleading. The best way is to use official English documents. It is recommended that Beginners use official documents, especially the following two pages for beginners:

Installing MySQL Using a Standard Source Distribution :( install with Standard Source code)Http://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.htmlMySQL Source-Configuration Options: (source code Configuration parameter description)Http://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html

Installation steps:

# New mysql users and user groups
Shell> groupadd mysql
Shell> useradd-r-g mysql-s/bin/false mysql

# Go To The Source Code download directory and decompress it.
Shell> tar zxvf mysql-VERSION.tar.gz

# Enter the decompressed directory
Shell> cd mysql-VERSION

# Configure
Shell> cmake-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DWITH_BOOST = dir
# It is necessary to describe the above content in detail:
#1. mysql starts from a certain version (as if it was 5.7) and uses cmake for configuration, instead of./configure
#2. mysql Default Configuration parameters can be used normally. For details, refer to the second link above. If you do not need to modify the parameters, you do not need to configure them. Here we only configure the default Character Set and default encoding.
#3. mysql 5.7.11 requires boost (a c ++ library). The address of the library needs to be configured after DWITH_BOOST. We recommend that you download the mysql source package with the boost library directly.
# Start compilation and Installation
Shell> make & make install

# Clear temporary installation files
Shell> make clean
# Backup/etc/my. cnf file, delete/etc/my. cnf file: (the reason is that the file may already exist in the system. To avoid interfering with the normal use of mysql, delete it first)
Shell> cp/etc/my. cnf/etc/my. cnf. bak
Shell> rm-f/etc/my. cnf

# Enter the installation directory (installed in this directory by default)
Shell> cd/usr/local/mysql

# Change the main user and user group in the directory
Shell> chown-R mysql.
Shell> chgrp-R mysql.

# Initialization
Shell> bin/mysqld -- initialize-insecure -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data
Shell> bin/mysql_ssl_rsa_setup

# Change the primary user of the directory (set as root to prevent normal users from accidentally deleting the database)
Shell> chown-R root.

# Change the primary user of the data storage directory
Shell> chown-R mysql data

# Copying my. cnf
Shell> cp support-files // my-default.cnf/etc/my. cnf

# This step exists in the official documentation, but you do not understand the purpose. I skipped this step during installation.
Shell> bin/mysqld_safe -- user = mysql &

# Copy the Service Startup Script
Shell> cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysql

# Edit PATH search PATH
Shell> vi/etc/profile

# Add two lines at the end of the profile file
PATH =/usr/local/mysql/bin:/usr/local/mysql/lib: $ PATH
Export PATH

# Make the PATH search PATH take effect immediately:
Shell> source/etc/profile

# Start the MySQL Service
Shell> service mysql start
# MySQL prompt: Solution to The server quit without updating PID file problem: Run "ps-A | grep mysqld" to check whether The mysqld process exists, if "kill-9 process number" is used to kill and restart mysqld!

# Set automatic start of service upon startup
Shell> chkconfig mysql on

# Log on to and modify the MySQL user root password
Shell> mysql-u root
Mysql> use mysql; mysql> grant all privileges on *. * TO root @ "%" identified by "123456 ";
Mysql> flush privileges;
Mysql> exit;

If you have any questions, please contact me via E-mail: 523161658@qq.com

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.