Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of the tutorial on compiling and installing MySQL5.7.24 for CentOS7

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Installation dependency

(1) cmake is a compilation tool for the new version of MySQL.

The following dependencies of sudo yum install gcc gcc-c++ pcre pcre-devel openssl openssl-devel sudo yum install zlib zlib-devel cmake ncurses ncurses-devel bison bison-devel need to be installed in CentOS7, and CentOS6 does not require sudo yum install perl perl-devel autoconf to install boost

If you install MySQL5.7 or above, you need to install boost before compiling the installation, because the higher version of mysql requires the installation of the boots library to function properly. Otherwise, CMake Error at cmake/boost.cmake:81 error will be reported.

1. Change to the / usr/local directory and download boost from this directory

MySQL5.7.24 requires that the version of boost is 1.59, and later versions of MySQL5.7.24 are not applicable.

Wget http://www.sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz

two。 Decompress and rename

Tar zxvf boost_1_59_0.tar.gzmv boost_1_59_0 boost

3. Add-DWITH_BOOST=/usr/local/boost when precompiling and installing MySQL

Compile and install MySQL# add MySQL user useradd-s / sbin/nologin-M mysql# download MySQLwget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24.tar.gz# extract MySQLtar zxvf mysql-5.7.24.tar.gz# into the MySQL directory cd mysql-5.7.24# precompiled cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.7.24\-DWITH_BOOST=/ Usr/local/boost\-DMYSQL_UNIX_ADDR=/usr/local/mysql-5.7.24/tmp/mysql.sock\-DMYSQL_DATADIR=/usr/local/mysql-5.7.24/data\-DDEFAULT_CHARSET=utf8mb4\-DDEFAULT_COLLATION=utf8mb4_general_ci\-DWITH_EXTRA_CHARSETS=all\-DWITH_MYISAM_STORAGE_ENGINE=1\-DWITH_INNOBASE_STORAGE_ENGINE=1\-DWITH_MEMORY_STORAGE_ENGINE=1\-DWITH_READLINE=1\-DWITH_INNODB_MEMCACHED=1\-DWITH_DEBUG=OFF\-DWITH_ZLIB=bundled\ -DENABLED_LOCAL_INFILE=1\-DENABLED_PROFILING=ON\-DMYSQL_MAINTAINER_MODE=OFF\-DMYSQL_TCP_PORT=3306# compilation & install make & & make install configuration # create soft connection cd / usr/localln-s mysql-5.7.24 mysql# add to environment variable vim / etc/profileexport PATH=/usr/local/mysql/bin:$PATHexport PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATHsource / etc/profilecd / usr/local/mysql-5.7 .24mkdir-p / usr/local/mysql-5.7.24/ {data Tmp,logs,pids} chown mysql.mysql / usr/local/mysql-5.7.24/datachown mysql.mysql / usr/local/mysql-5.7.24/tmpchown mysql.mysql / usr/local/mysql-5.7.24/logschown mysql.mysql / usr/local/mysql-5.7.24/pids# modify / etc/my.cnf file Edit the configuration file as follows: [mysqld] character-set-server=utf8mb4collation-server=utf8mb4_general_cidatadir=/usr/local/mysql/datasocket=/usr/local/mysql/tmp/ mysql.sock [mysqld _ safe] log-error=/usr/local/mysql/logs/mysqld.logpid-file=/usr/local/mysql/pids/mysqld.pid [client] default-character-set=utf8mb4# create mysqld.log and mysqld.pid file touch / usr/local/mysql/logs/mysqld.logtouch / usr/local/mysql/pids/mysqld .pidchown mysql.mysql-R / usr/local/mysql/logs/chown mysql.mysql-R / usr/local/mysql/pids/# join the daemon cd / usr/local/mysqlcp support-files/mysql.server / etc/init.d/mysqldchmod adepx / etc/init.d/mysqldchkconfig-- add mysqldchkconfig mysqld on# initializes the database -initialize means to generate a secure password by default, and-initialize-insecure means not to generate a password mysqld-- initialize-insecure-- user=mysql-- basedir=/usr/local/mysql-- datadir=/usr/local/mysql/data# to start MySQLservice mysqld start

Here is a configuration diagram of / etc/my.cnf

Log in to MySQL and change your password

Mysql-u root-p # you don't need a password to log in for the first time. Enter set password for root@localhost = password ('root'); # change the password

Summary

The above is the editor to introduce to you the CentOS7 compilation and installation of MySQL5.7.24 tutorial details, I hope to help you, if you have any questions, please leave me a message, the editor will reply to you in time. Thank you very much for your support to the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report