Centos7 Source Installation MySQL8.0.12

Source: Internet
Author: User

The official MySQL installation layout is:/usr/local/mysql{bin,docs,man,include,lib,share,support-files}

For compiled Boolean options, you can specify a value of 1 or on to enable the option, and 0 or off to disable the option. Many option configurations can overwrite the default values at compile time when the server starts.

1. Pre-Preparation:

Uninstall the system comes with MySQL and configuration files and libraries, run Rpm-qa|grep-i mysq and rpm-qa|grep-i mariadb, use RPM-E--nodes first two fame to sift out the package, and then look at/etc/ Whether the my.cnf file exists, if it is also deleted;

New MySQL user and group that cannot log in, run Groupadd mysql,useradd-r-s/sbin/nologin-g MySQL MySQL;

Install the necessary packages, run yum-y install install GCC gcc-c++ cmake make ncurses Libaio OpenSSL Perl

2. Unzip the source package:

First in the/root directory to create the BLD directory (the name is random), the directory is used to execute the cmake command, a separate directory is to keep the source files clean, and then create/usr/local/src/mysql directory used to store the source package extracted files for subsequent use;

Run TAR-ZXVF mysql-boost-8.0.12.tar.gz-c/usr/local/src/mysql

3. About boost Processing:

MySQL8 's source package contains boost and does not contain boost, if the source package does not contain boost and does not install boost separately, then when executing CMake, remember to add these options-ddownload_boost=on-ddownload_boost_ Timeout=1200-dwith_boost=/usr/local/boost

If the source package is included in the boost, in the execution of CMake also specify the position of boost, boost is generally in the source package extracted from the file under the Boost directory;

This time using the source with boost installation, because does not include the boost source installation in the download boost speed is very slow even if the wait time set 1200 seconds may be disconnected.

4. About character sets and sorted character sets:

The server character set. By default, MySQL uses the utf8mb4 character set. If the Mysql-srcfile/cmake/character_sets.cmake file is listed as a value charsets_available using another allowed character set.

Server collation. By default, MySQL uses Utf8mb4_0900_ai_ci. Use the default character set and proofing rules.

4. Execution CMake:

Centos7 recommended to use SYSTEMD management to start the task, so to open SYSTEMD support;

Cd/root/bld

cmake/usr/local/src/mysql/mysql-8.0.12 \

-dbuild_config=mysql_release \

-dwith_systemd=on \

-dwith_boost=/usr/local/src/mysql/mysql-8.0.12/boost

5. Execute make again, if the machine performance is normal, it will be executed for a long time, almost 2 hours;

6. Initializing the database

Go to MySQL's base directory and run./bin/mysqld--initialize-insecure --user=mysql这条命令不会生成root的初始密码,如果使用--initialize代替--initialize-insecure的话,会生成root的初始密码,使用grep password /var/log/mysqld.log即可查看到;

The mysqld in the bin directory can also have parameters--defaults-file=/etc/my.cnf,这个参数是指定服务器启动时的配置参数,有些可以覆盖编译时的取值;

MYSQLD executes the initialization sequence:

    1. Check if the data directory exists, if it does not exist, the MYSQLD program will create it, if the data directory is not empty, then will be error, then you should delete the data directory (default is/usr/local/mysql/data at compile time, And does not specify the MY.CNF file when the initialization is executed, even if the my.cnf file is specified but the file does not indicate this configuration, it is also using the compile-time value or default value);
    2. in the data directory, the server creates mysql system databases and their tables, including authorization tables, server-side help tables, and time zone tables.
    3. The server initializes the system table space and related data structure InnoDB required to manage the table.
    4. Server created ' root ' @ ' localhost ' super user account and other reserved accounts some reserved accounts are locked and the client is not available, but ' root ' @ ' localhost ' is for administrative use only.
    5. If the share directory under the base directory exists Fill_help_tables.sql and is available, the file is executed to populate the server-side Help table.
    6. If--init-file is executed at initialization and is valid, the file SQL after the parameter is executed, which is used primarily for custom boot sequences (not currently understood), and when the server is running in boot mode, some features are not available, which limits the statements allowed in the file. These include with account management (for example CREATE USER or GRANT ), replication, and global transaction identifiers The related statement .

7. Start MySQL

Assign MySQL's base directory to MySQL users and groups: Chown-r Mysql:mysql/usr/local/mysql;

Execute systemctl start mysqld, because-dwith_systemd=on is specified at compile time, the Bin/mysqld_safe file will not be installed when the SYSTEMD management task is started;

8. Configure Auto-start

Cond

  

  

Centos7 Source Installation MySQL8.0.12

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.