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

How to realize mysql5.7.16 compilation and installation in centos7.x system

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly gives you a brief introduction to centos7.x system how to achieve mysql5.7.16 compilation and installation, related professional terms you can look up on the Internet or find some related books to supplement, here we will not dabble in, let's go straight to the topic, I hope that how the centos7.x system to achieve mysql5.7.16 compilation and installation of this article can bring you some practical help.

# system installation conditions

1 > cmake

MySQL uses the cmake cross-platform tool to precompile the source code to set the compilation parameters of mysql. Such as: installation directory, data storage directory, character encoding, sorting rules and so on. Just install the latest version.

2 > make3.75

The mysql source code is written in C and C++ language. Make is used to compile and build the source code under Linux. Make 3.75 or above is required.

3 > gcc4.4.6

GCC is a C language compilation tool under linux. Mysql source code compilation is written entirely in C and C++. GCC4.4.6 or above is required.

4 > Boost1.59.0

C++ 's Boost library is used in the mysql source code, and boost1.59.0 or above is required.

5 > bison2.1

C _ syntax + parser under Linux

6 > ncurses

Character terminal processing library

Warm tip from the official website: if you encounter problems such as "internal compiler errors" when compiling large source files, there may be too little memory. If you are compiling on a virtual machine, try increasing the memory allocation.

# in fact, this cmake does not need to be upgraded. The official website says that make is doing more work. Yum erase cmake# download cmakewget-c https://cmake.org/files/v3.7/cmake-3.7.2.tar.gztar zxvf cmake-3.7.2.tar.gz-C / usr/local/src# download boostwget-c mkdir-p / usr/local/boostcp boost_1_59_0.tar.gz / usr/local/boost# download mysql5.7.16wget-c tar-zxf mysql-5.7.16.tar.gz-C / usr/local / srcyum install-y apr* autoconf automake bison bzip2 bzip2* cloog-ppl cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libXpm* libxml*?libXaw-devel libXmu-devel libtiff libtiff* make mpfr ncurses* ntp openssl openssl-devel patch pcre-devel perl php-common php-gd policycoreutils telnet T1lib t1lib * nasm nasm* wget zlib-devel# compiler installation cmkaecd / usr/local/src/cmake-3.7.2./configuremakemake installln-sf / usr/local/bin/cmake / usr/bin/cmake# installation mysql database # add mysql group groupadd mysql # create user mysql and join the mysql group Mysql users are not allowed to log in directly to the system useradd-g mysql mysql- s / bin/false # to create MySQL database storage directory mkdir-p / data/mysql # set MySQL database storage directory permissions chown-R mysql:mysql / data/mysql # create MySQL installation directory mkdir-p / usr/local/mysql cd / usr/local/src/mysql-5.7.18mkdir bldcd bldcmake.. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/data/mysql-DWITH_INNOBASE_STORAGE_ENGINE=1-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DWITH_EMBEDDED_SERVER=OFF-j `grep processor / proc/cpuinfo | wc-l`make install# installed successfully # if there is an error in compilation, delete the files that failed to compile before recompiling. When recompiling, you need to clear the old object files and cache information. # make clean#rm-f CMakeCache.txt#rm-rf / etc/my.cnf # Delete the default configuration file of the system (if not) # generate the database password cd / usr/local/mysql # enter the MySQL installation directory. / bin/mysqld-- user=mysql-- initialize--basedir=/usr/local/mysql-- datadir=/data/mysql # generate the mysql system database-- initialize means the default password is generated,-- initialize-insecure means no password is generated The password is empty. # # 2017-07-05T02:52:50.934379Z 1 [Note] A temporary password is generated for root@localhost: x5fujvwK25:y# setting to boot cp / usr/local/mysql/support-files/my-default.cnf / usr/local/mysql/my.cnfln-s / usr/local/mysql/my.cnf / etc/my.cnf # soft connection cp / usr/local/mysql/support-files/mysql.server / etc/rc.d/init.d/ added to / etc directory Mysqld # add Mysql to system startup chmod / etc/init.d/mysqld # add execution permissions chkconfig mysqld on # add boot vi / etc/rc.d/init.d/mysqld # Edit basedir=/usr/local/mysql # MySQL program installation path datadir=/data/mysql # MySQl database storage directory: wq! # Save exit service mysqld start # start vi / etc/profile # add mysql service to the system environment variable: add at the end Add the following line export PATH=$PATH:/usr/local/mysql/bin:wq! # Save exit source / etc/profile # make the configuration effective immediately # the following two lines link the library files of myslq to the default location of the system In this way, you don't have to specify the library file address of mysql when compiling software like PHP. Ln-s / usr/local/mysql/lib/mysql / usr/lib/mysqlln-s / usr/local/mysql/include/mysql / usr/include/mysqlmkdir / var/lib/mysql # create directory ln-s / tmp/mysql.sock / var/lib/mysql/mysql.sock # add soft link mysql_secure_installation # modify Mysql password, enter the password generated earlier, enter and follow the prompts. Press y | Y for Yes, any other key for No: y # do you want to install password security plug-ins? Choose yThere are three levels of password validation policy: # choose LOW Length > = 8MEDIUM Length > = 8, numeric, mixed case, and special charactersSTRONG Length > = 8, numeric, mixed case, special characters and dictionary filePlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 # Select 0, as long as 8 digits, select 1 to have uppercase, lowercase, special characters and other UNINSTALL PLUGIN validate_password; # uninstall password strength plug-in use mysql Update mysql.user set authentication_string=password ('123456') where user='root'; # Log in to the mysql console to modify the ALTER USER' root'@'localhost' IDENTIFIED WITH mysql_native_password AS '123456password; # change the password # it's too troublesome to log in to the mysql console and change the password. Use the following command to # authorize root remote access with the password rootmysql-uroot-prootGRANT ALL PRIVILEGES ON *. * TO' root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;FLUSH PRIVILEGES

Steps of compiling and installing mysql with official website

# Preconfiguration setupshell > groupadd mysqlshell > useradd-r-g mysql- s / bin/false mysql# Beginning of source-build specific instructionsshell > tar zxvf mysql-VERSION.tar.gzshell > cd mysql-VERSIONshell > mkdir bldshell > cd bldshell > cmake.. shell > makeshell > make install# End of source-build specific instructions# Postinstallation setupshell > cd / usr/local/mysqlshell > chown-R mysql .shell > chgrp-R mysql .shell > bin/mysql_install_db-user=mysql # Before MySQL 5.7.6shell > bin/mysqld-initialize-user=mysql # MySQL 5.7.6 and upshell > bin/ Mysql_ssl_rsa_setup # MySQL 5.7.6 and upshell > chown-R root .shell > chown-R mysql datashell > bin/mysqld_safe-- user=mysql & # Next command is optionalshell > cp support-files/mysql.server / etc/init.d/mysql.server

Attached to the network parameter configuration reference, but I use the netizen this compilation installation is not successful. Here is just to refer to the parameters of his remarks, and the parameters of the remarks feel OK.

# cmake\-DWITH_BOOST=/usr/local/boost_1_59_0\ [boost directory]-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ [root directory of MySQL installation]-DMYSQL_DATADIR=/mydata/mysql/data\ [directory where MySQL database files are stored]-DSYSCONFDIR=/etc\ [directory where the MySQL configuration file is located]-DMYSQL_USER=mysql\ [MySQL user name]-DWITH_MYISAM_STORAGE_ENGINE=1\ [MySQL's database engine]-DWITH_INNOBASE_STORAGE_ENGINE=1\ [MySQL's database engine]-DWITH_ARCHIVE_STORAGE_ENGINE=1\ [MySQL's database engine]-DWITH_MEMORY_STORAGE_ENGINE=1\ [MySQL's database engine]-DWITH_READLINE=1\ [MySQL's readline library]-DMYSQL_UNIX_ADDR=/var/run/mysql/mysql.sock\ [MySQL's communication directory]-DMYSQL_TCP_PORT=3306\ [listening port of MySQL]-DENABLED_LOCAL_INFILE=1\ [enable loading of local data]-DENABLE_DOWNLOADS=1\ [allow independent download of related files at compile time]-DWITH_PARTITION_STORAGE_ENGINE=1\-DEXTRA_CHARSETS=all\ [make MySQL supports all extended characters]-DDEFAULT_CHARSET=utf8\ [set default character set to utf8]-DDEFAULT_COLLATION=utf8_general_ci\ [set default character proofreading]-DWITH_DEBUG=0\ [disable debug mode]-DMYSQL_MAINTAINER_MODE=0\-DWITH_SSL:STRING=bundled\ [support ssl protocol when communicating]-DWITH_ZLIB:STRING=bundled [allow the use of zlib library]

Centos7.x system how to achieve mysql5.7.16 compilation and installation will first tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

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