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

RHEL7.2 compilation and installation of mysql5.7.13

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

Share

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

1. Uninstall MySql or mariadb and boost that come with the system.

[root@node1 ~] # rpm-qa | grep mysql

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

Mariadb-libs-5.5.44-2.el7.x86_64

[root@node1] # rpm-e-- nodeps mariadb-libs-5.5.44-2.el7.x86_64

[root@node1 ~] # rpm-qa | grep boost

Boost-thread-1.53.0-25.el7.x86_64

Boost-system-1.53.0-25.el7.x86_64

[root@node1] # rpm-e-- nodeps boost-thread-1.53.0-25.el7.x86_64

[root@node1] # rpm-e-- nodeps boost-system-1.53.0-25.el7.x86_64

[root@node1 ~] # rpm-qa | grep boost

[root@node1 ~] #

2. Check whether there are mysql users and groups

[root@node1 boost] # cat / etc/group | grep mysql

[root@node1 boost] # cat / etc/passwd | grep mysql

[root@node1 boost] #

3. Create mysql users and groups

[root@node1 boost] # groupadd mysql

[root@node1 boost] # useradd-r-g mysql mysql

[root@node1 boost] #

4. Create the mysql installation directory

[root@node1 boost] # mkdir / usr/local/mysql

[root@node1 boost] # mkdir / usr/local/mysql/data

[root@node1 boost] #

5. Install compiling software

Yum-y install make gcc-c++ cmake libaio libaio-devel perl-Data-Dumper net-tools ncurses-devel bison bison-devel gcc-c++ ncurses-devel cmake perl gcc autoconf automake zlib libxml libgcrypt libtool

6. Install lrzsz and upload MySql package using lrzsz

[root@node1 ~] # yum install lrzsz

[root@node1 ~] # rz

Upload MySql package

7. Decompress MySql packet

[root@node1 ~] # tar zxvf mysql-boost-5.7.13.tar.gz

8 、 cmake

Cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/usr/local/mysql/data-DSYSCONFDIR=/etc-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock-DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_INNOBASE_STORAGE_ENGINE=1-DMYSQL_TCP_PORT=3306-DENABLED_LOCAL_INFILE=1-DWITH_PARTITION_STORAGE_ENGINE=1-DEXTRA_CHARSETS=all-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DWITH_BOOST=/root/mysql-5.7.13/boost/-DWITH_SYSTEMD=1

9 、 make

Make-j 6\\ specify several threads

10. Make install\\ install to the specified directory

11. Change mysql directory permissions

[root@node1 boost] # chown-R mysql:mysql / usr/local/mysql/

12. Add the execution path of mysql to PATH

[root@node1 mysql-5.7.13] # vi / etc/profile

Export PATH=$PATH:/usr/local/mysql/bin\\ add this line to the last line

[root@node1 mysql-5.7.13] # source / etc/profile

13. Cp configuration file

# cp / usr/local/mysql/support-files/my-default.cnf / etc/my.cnf

14. Modify / etc/my.cnf

Basedir = / usr/local/mysql

Datadir = / usr/local/mysql/data

Port = 3306

Server_id = 1

Socket = / usr/local/mysql/data/mysql.sock

Log-error = / usr/local/mysql/data/mysql.err

15. Configure and modify mysqld.service files

[root@node1 mysql-5.7.13] # cp / usr/local/mysql/usr/lib/systemd/system/mysqld.service / usr/lib/systemd/system/

[root@node1 mysql-5.7.13] #

Vi / usr/lib/systemd/system/mysqld.service

Modify PIDFile=/usr/local/mysql/data/mysqld.pid\\ to the corresponding path

-- pid-file=/usr/local/mysql/data/mysqld.pid\\ is modified to the corresponding path

[root@node1 ~] # systemctl daemon-reload

16. Initialize the database

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

17. Start the mysql process

[root@node1 ~] # systemctl start mysqld

18. Log in to MySql database

[root@node1 system] # / usr/local/mysql/bin/mysql-u root

19. Change the password

ALTER USER 'root'@'localhost' IDENTIFIED BY' root@123'

20. Remote login permissions

GRANT ALL PRIVILEGES ON *. * TO root@'%' IDENTIFIED BY 'root@123'

FLUSH PRIVILEGES

21. Configure mysql self-startup

[root@node1 ~] # systemctl enable mysqld

22. Turn on the firewall for mysql

Firewall-cmd-permanent-zone=public-add-port=3306/tcp

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