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

Compile and deploy mysql5.7.13

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

Share

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

Deployment environment centos7.2+mysql5.7.13

1. Dependent package

Note: the role of related dependency packages

Cmake: since the regular configure compilation method has been abandoned since the MySQL5.5 version, CMake compilation is required

Device that is used to set the compilation parameters of mysql. Such as: installation directory, data storage directory, character encoding, sorting rules and so on.

Boost # Boost library is required from MySQL 5.7.5. C++ 's Boost library is used in mysql source code, which requires

Boost1.59.0 or above must be installed

GCC is a C language compilation tool under Linux. Mysql source code compilation is written entirely in C and C++, so it must be installed.

GCC

C _ syntax + parser under bison:Linux

Ncurses: character terminal processing library

1) install CMAKE and necessary software

-

Install cmake

Cmake-version-View the cmake version

Install ncurses

Install bison

Install bootst

Tar zxf boost_1_59_0.tar.gz

Mv boost_1_59_0 / usr/local/boost

2) create mysql users and user groups and directories

Groupadd-r mysql & & useradd-r-g mysql-s / bin/false-M mysql

-New msyql group and msyql users are prohibited from logging in to shell

# mkdir / usr/local/mysql-create a directory

# mkdir / usr/local/mysql/data-database directory

2. Compile and install mysql source code package

Decompress the mysql source package:

Execute the cmake command for pre-compilation configuration & compilation:

Make & & make install

In order to speed up the compilation speed, you can compile and install as follows

Make-j $(grep processor / proc/cpuinfo | wc-l) & & make install

The-j parameter specifies the number of threads at compile time based on the number of CPU cores, which can speed up compilation. The default is 1 thread compilation.

To rerun the cmake configuration, you need to delete the CMakeCache.txt file

Configuration meaning:

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql [root directory of MySQL installation]

-DMYSQL_DATADIR=/usr/local/mysql / data [directory for storing MySQL database files]

-DSYSCONFDIR=/etc [directory where the MySQL configuration file is located]

-DWITH_MYISAM_STORAGE_ENGINE=1 [add MYISAM engine support]

-DWITH_INNOBASE_STORAGE_ENGINE=1 [add InnoDB engine support]

-DWITH_ARCHIVE_STORAGE_ENGINE=1 [add ARCHIVE engine support]

-DMYSQL_UNIX_ADDR=/usr/local/mysql / mysql.sock [specify mysql.sock location]

-DWITH_PARTITION_STORAGE_ENGINE=1 [installation supports database partitioning]

-DEXTRA_CHARSETS=all [enables MySQL to support all extended characters]

-DDEFAULT_CHARSET=utf8 [sets the default character set for MySQL to

Utf8]-DDEFAULT_COLLATION=utf8_general_ci [set default character set alignment rules]

-DWITH-SYSTEMD=1 [systemd can be used to control mysql service]

-DWITH_BOOST=/usr/local/boost [points to the directory where the boost library is located]

Optimize the execution path of Mysql

3. Set permissions and initialize MySQL system authorization table

Cd / usr/local/mysql

# chown-R mysql:mysql. -change the owner, belong to the group, and note that it is mysql.

# bin/mysqld-initialize-user=mysql-basedir=/usr/local/mysql

-- datadir=/usr/local/mysql/data

# version of the initial system database script after 5.7.6 (initialized in this article) * *

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

5. Create a configuration file

Cd / usr/local/mysql/support-files-enter the MySQL installation directory support files directory

Cp my-default.cnf / etc/my.cnf-copy template to new configuration file

The official website says that my-default.cnf files will not be provided in binary packages from 5.7.00 onwards.

Create the configuration options in the file, as shown in the following figure, and add the following configuration items

Vim / etc/my.cnf

[mysqld]

6. Configure mysql to start automatically

Cp / usr/local/mysql/usr/lib/systemd/system/mysqld.service / usr/lib/systemd/system/

Modify / usr/lib/system/system/mysqld.service

Systemctl daemon-reload

Ss-npatl | grep 3306

Mysql-u root-p / No password

Alter user root@localhost identified by 'abcD001encrypted; / password must meet a certain complexity, otherwise it cannot take effect.

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