CentOS7 under source installation MySQL 8.0.11

Source: Internet
Author: User
Tags install openssl openssl

CentOS7 under source installation MySQL 8.0.11

System environment: CENTOS7, kernel: Linux 3.10.0-862.el7.x86_64

  1. If the old version of MySQL, first uninstall, use the following command to find out what the system is related to the MySQL package.

    Rpm-qa | grep MySQL

  2. If the above command queries the relevant MySQL package, uninstall the

    RPM-E Package Name

  3. Uninstalling the MARIADB Package

    Yum Remove mariadb-libs.x86_64

  4. Download the source package from the MySQL website and copy the file to the system.

    https://dev.mysql.com/downloads/mysql/
    Note: Download the package with boost: mysql-boost-8.0.11.tar.gz, size: 74.1M

  5. Install and compile the necessary packages

    Yum-y install make gcc-c++ cmake bison-devel ncurses-devel

  6. Create MySQL users and groups that are used only as MySQL services and cannot be used to log on to the system

    useradd-g MySQL mysql-m-s/sbin/nologin

  7. Verify the integrity of the source compression package and extract the source package to/usr/local/mysql-8.0.11

    Md5sum mysql-boost-8.0.11.tar.gz
    TAR-ZXVF mysql-boost-8.0.11.tar.gz-c/usr/local

  8. Executive CMake

    CMake \
    -ddownload_boost=1 \
    -dwith_boost=/usr/local/mysql-8.0.11/boost/boost_1_66_0/boost \
    -dwith_debug=1 \
    -dcmake_install_prefix=/usr/local/mysql \
    -dmysql_datadir=/usr/local/mysql/data \
    -dwith_boost=/usr/local/boost \
    -DSYSCONFDIR=/ETC \
    -DEFAULT_CHARSET=UTF8MB4 \
    -DDEFAULT_COLLATION=UTF8MB4_GENERAL_CI \
    -denabled_local_infile=1 \
    -dextra_charsets=all

  9. There was an error in the execution of the cmake, such as the lack of a relevant OpenSSL development package.
  10. Install the default dependency package

    Yum Install openssl-devel.x86_64 openssl-static.x86_64 openssl-perl.x86_64

  11. Delete CMakeCache.txt or rename, rename the file here.

    MV CMakeCache.txt CMAKECACHE.TXT.BK

  12. Perform the cmake operation again, and finally no error.

    CMake \
    -ddownload_boost=1 \
    -dwith_boost=/usr/local/mysql-8.0.11/boost/boost_1_66_0/boost \
    -dwith_debug=1 \
    -dcmake_install_prefix=/usr/local/mysql \
    -dmysql_datadir=/usr/local/mysql/data \
    -dwith_boost=/usr/local/boost \
    -DSYSCONFDIR=/ETC \
    -DEFAULT_CHARSET=UTF8MB4 \
    -DDEFAULT_COLLATION=UTF8MB4_GENERAL_CI \
    -denabled_local_infile=1 \
    -dextra_charsets=all

  13. Perform a make operation that takes a long time to execute and wait patiently.

    Make

  14. Execute make Install

    Make install

  15. Switch to directory/usr/local/mysql/bin, initialize MySQL, and the password for the database root account is empty.

    ./mysqld--initialize-insecure--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data

16. Configure the startup script

Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld
Chkconfig--add mysqld
Chkconfig mysqld on

17. Start Mysqld

Service mysqld Start
Output result: Starting MySQL success!

18. Verify that the MySQL service is started and related processes

Ps-ef | grep mysqld

19. Database Native Logon Database

./mysql-uroot-p

20. View the database engine that is used by default.

Mysql> SHOW ENGINES;

21. View the database created by default

mysql> show databases;

22. Update the database root password (due to a blank password at the time of initialization), execute the following commands separately in an environment connected to SQL.

ALTER USER ' root ' @ ' localhost ' identified by ' new_password ';
ALTER USER ' root ' @ ' localhost ' PASSWORD EXPIRE never;
Flush privileges;

23. Finally exit the data connection, with the new password login to verify that the new password is valid.

CentOS7 under source installation MySQL 8.0.11

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.