Get the App
SLTechnology News&Howtos  ›  Database  › 

Multiple installation methods of MySQL5.7

Shulou Source: shulou.com Published: 2022-05-31 18:22:51 10月02日 Update

This article introduces the relevant knowledge of "multiple installation methods of MySQL5.7". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Experimental platform: CentOS 6.5

Mysql version: 5.7.11 Community Edition

① source code installation

Installation dependency

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

Unlike previous versions, compiling the source code installation depends on boost 1.59

You can download it manually from http://www.boost.org/users/history/version_1_59_0.html.

In linux:

Wget http://jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

If there is no boost, or if the version is less than 1.59, it will be thrown when cmake:

Could not find (the correct version of) boost.

-- MySQL currently requires boost_1_59_0

You can also choose to download and install automatically when cmake, only need to specify additional when cmake:

-DDOWNLOAD_BOOST=1-DWITH_BOOST=/usr/local/include/boost

If the output is as follows, it means that the automatic download of the boost package begins.

-- MySQL 5.7.11

-- Packaging as: mysql-5.7.11-Linux-x86_64

-- Downloading boost_1_59_0.tar.gz to / usr/local/include/boost

-- [download 0 complete]

-- [download 1% complete]

Reconfirm the cmake version, here is

# cmake-version

Cmake version 2.8.12.2

After decompressing, go to the boost directory to install.

# cd boost_1_59_0/

#. / bootstrap.sh

#. / b2 install

Then prepare to install:

# groupadd mysql

# useradd-r-g mysql-s / bin/false mysql

# tar zxvf mysql-5.7.11.tar.gz

# cd mysql-5.7.11

Prepare cmake:

# cmake. -DCMAKE_INSTALL_PREFIX=/data/mysql3306\

-DMYSQL_DATADIR=/data/mysql3306/data\

-DMYSQL_UNIX_ADDR=/tmp/mysql3306.sock\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DMYSQL_TCP_PORT=3306\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci\

-DWITH_EXTRA_CHARSETS:STRING=utf8\

-DMYSQL_USER=mysql\

-DENABLED_LOCAL_INFILE=1 [\

-DDOWNLOAD_BOOST=1\

-DWITH_BOOST=/usr/local/include/boost]

(for more cmake options, please refer to 2 Installing and Upgrading MySQL-2.9 Installing MySQL from Source)

Note: if you have previously installed boost as in this article, you do not need to specify it.

If you specify the content in [], install boost for automatic download boost.

Then make & & make install, a slightly worse machine may take more than 30 minutes.

# make

# make install

Configure permissions and configuration files:

# cd / data/mysql3306/

# chown-R mysql.

# chgrp-R mysql.

# chmod overnx / data

# cp support-files/my-default.cnf / etc/my.cnf

Modify the configuration file:

Vi / etc/my.cnf

Add in [mysqld]

Datadir = / data/mysql3306/data

Basedir = / data/mysql3306/

Save exit

Initialize:

# bin/mysqld-initialize-user=mysql-datadir=/data/mysql3306/data-basedir=/data/mysql3306/

For versions prior to 5.7.6, you need to initialize it with mysql_install_db

Start the service:

# bin/mysqld_safe-- user=mysql &

The initialized random password is in errlog, such as:

[Note] A temporary password is generated for root@localhost: NP#

Tags: Mode version file selection configuration content more variety official source code knowledge process preparation service output different practical secure learned next Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Linux Shulou Information MariaDB NVidia