Get the App
SLTechnology News&Howtos  ›  Database  › 

Several steps of installing mysql by centso7.2 source code

Shulou Source: shulou.com Published: 2022-06-01 19:14:03 09月17日 Update

Here are a few steps to install mysql with centso7.2 source code. The secret of the text lies in being close to the topic. So, no gossip, let's go straight to the following, I believe you will benefit from reading this article on how to install mysql in centso7.2 source mode.

Install mysql-boost-5.7.17.tar.gz in source mode

1. Preparatory work

Close SELinux and download the package from the firewall-> https://www.mysql.com/

Uninstall mariadb that comes with it

2. Uninstall the mariadb software that comes with the system

[root@mysqltest ~] # rpm-qa | grep mariadb

Mariadb-libs-5.5.44-2.el7.centos.x86_64

[root@mysqltest] # rpm-e-nodeps mariadb-libs

3. Create a data directory / mydata/data

[root@mysqltest] # mkdir-p / mydata/data

Modify the ownership of the data directory

[root@node02] # useradd-s / sbin/nologin-M mysql

[root@node02] # chown-R mysql.mysql / mydata/data/

4. Install the cmake compiler

[root@node02 ~] # yum install-y cmake

[root@node02 ~] # tar zxf mysql-boost-5.7.17.tar.gz

Cmake. -L View compilation options supported by cmake

[root@node02 ~] # cd mysql-5.7.17/

[root@mysql57 mysql-5.7.17] # cmake. \

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci\

-DMYSQL_DATADIR=/mydata/data\

-DMYSQL_TCP_PORT=3306\

-DWITH_BOOST=boost/boost_1_59_0/\

-DWITH_MYISAM_STORAGE_ENGINE=1\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_ARCHIVE_STORAGE_ENGINE=1\

-DWITH_BLACKHOLE_STORAGE_ENGINE=1\

Error 1:

CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.

CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

CMake Error at cmake/os/Linux.cmake:41 (MESSAGE):

Unsupported compiler!

Call Stack (most recent call first):

CMakeLists.txt:162 (INCLUDE)

Solution:

# yum groupinstall-y "Development Tools"Server Platform Development"Desktop Platform Development"

Error 2:

CMake Error at cmake/readline.cmake:64 (MESSAGE):

Curses library not found. Please install appropriate package

Solution:

[root@node02 ~] # yum install-y ncurses-devel.x86_64

[root@mysqltest mysql-5.7.17] # make

[root@mysqltest mysql-5.7.17] # make install

[root@mysqltest] # chown-R root.mysql / usr/local/mysql/

5. Initialize the database

[root@mysql57] # / usr/local/mysql/bin/mysqld-initialize-user=mysql-basedir=/usr/local/mysql-datadir=/mydata/data

6. Copy the MySQL configuration file

[root@node02 ~] # cd / usr/local/mysql/support-files/

[root@node02 support-files] # cp my-default.cnf / etc/my.cnf

[root@node02 support-files] # vim / etc/my.cnf

[mysqld]

...

Basedir=/usr/local/mysql

Datadir=/mydata/data

Port=3306

Server_id=121

Socket=/tmp/mysql.sock

7. Start the mysql service

[root@mysqltest data] # / usr/local/mysql/bin/mysqld_safe-- user=mysql &

[root@mysqltest data] # ss-antp | grep mysqld

LISTEN 0 80: 3306: * users: ("mysqld", pid=63756,fd=20)

[root@mysqltest data] #

8. Modify the environment variable PATH

[root@mysqltest] export PATH=$PATH:/usr/local/mysql/bin temporary

[root@mysqltest] echo $PATH

[root@mysqltest data] # cat / etc/profile.d/mysql.sh

Export PATH=$PATH:/usr/local/mysql/bin

[root@mysqltest data] # source / etc/profile.d/mysql.sh

[root@mysqltest data] # mysql-u root-p

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' Www.1.com'

Mysql > FLUSH PRIVILEGES

Query OK, 0 rows affected (0.00 sec)

9. Set the source code mysql service to boot automatically

# vim / etc/rc.d/rc.local

/ usr/local/mysql/bin/mysqld_safe-user=mysql &

For the above centso7.2 source code installation of mysql several steps related to the content, is there anything you do not understand? Or if you want to know more about it, you can continue to follow our industry information section.

Tags: Source code methods steps data methods directories software errors services compilation following topics content variables places mysteries ownership databases files text Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Tech Info MySQL NVidia Microsoft