CentOS7 under source installation MySQL 8.0.11
System environment: CENTOS7, kernel: Linux 3.10.0-862.el7.x86_64
- 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
- If the above command queries the relevant MySQL package, uninstall the
RPM-E Package Name
- Uninstalling the MARIADB Package
Yum Remove mariadb-libs.x86_64
- 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
- Install and compile the necessary packages
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel
- 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
- 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
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
- There was an error in the execution of the cmake, such as the lack of a relevant OpenSSL development package.
Install the default dependency package
Yum Install openssl-devel.x86_64 openssl-static.x86_64 openssl-perl.x86_64
- Delete CMakeCache.txt or rename, rename the file here.
MV CMakeCache.txt CMAKECACHE.TXT.BK
- 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
- Perform a make operation that takes a long time to execute and wait patiently.
Make
- Execute make Install
Make install
- 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