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

What are the steps for installing the mysql5.7forcentos7.6 source code

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

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the steps of mysql5.7forcentos7.6 source code installation, the content is very detailed, interested friends can refer to, hope to be helpful to you.

The detailed deployment steps are as follows:

1. Preparation before installation

1) disable the firewall and modify SELinux

Vim / etc/selinux/config

SELINUX=disabled

2) turn off the firewall

Systemctl status firewalld.service

Systemctl stop firewalld.service

Systemctl disable firewalld.service

3) tools required to install MySQL

Yum install\

Vim\

Git\

Gcc\

Gcc-c++\

Wget\

Make\

Cmake\

Automake\

Autoconf\

Libaio\

Libtool\

Net-tools\

Bison\

Bison-devel\

Libaio-devel\

Ncurses-devel\

Perl-Data-Dumper\

-y

4) check if MySQL is installed on the operating system

Rpm-qa | grep mysql

Yum remove mysql-libs

5) download the source code installation package

Cd / apps/rpm

Wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.27.tar.gz

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

two。 Add users and groups:

Groupadd apps

Useradd-d / home/apps-g apps-m apps

Passwd apps123

3. Create directory and authorization

Mkdir-p / apps/conf/mysql # config directory

Mkdir-p / apps/dbdat/mysql57_3306 # dbdata directory

Mkdir-p / apps/binlog/mysql57_3306 # binlog directory

Mkdir-p / apps/logs/mysql # log directory

Mkdir-p / apps/svr/mysql57 # binary directory

Mkdir-p / apps/tmp

Mkdir-p / apps/run

Mkdir-p / apps/sh/tool

Mkdir-p / apps/rpm

Chown-R apps:apps / apps

Chmod-R 755 / apps

4. With MySQL environment variables

Vi / etc/profile

Export.UTF-8

Export PATH=$PATH:/usr/sbin

Export PATH=$PATH:/apps/svr/mysql57/bin

Export PATH=$PATH:/apps/sh/tool/

Export MYSQL_HISTFILE=/dev/null

> ~ / .mysql_history

/ bin/bash / apps/sh/log_name.sh

5. Decompression

Cd / apps/rpm/

Tar-xzvf boost_1_59_0.tar.gz

Cd / apps/rpm

Tar-xzvf mysql-5.7.27.tar.gz

6. Go to the extracted mysql-5.7.27 directory, compile the source code and generate makefile.

Compile and install

Cmake\

-DCMAKE_INSTALL_PREFIX=/apps/svr/mysql57\

-DMYSQL_DATADIR=/apps/dbdat/mysql57_3306\

-DSYSCONFDIR=/app/conf/mysql\

-DWITH_BOOST=/apps/rpm/boost_1_59_0\

-DDEFAULT_CHARSET=utf8mb4\

-DDEFAULT_COLLATION=utf8mb4_unicode_ci\

-DEXTRA_CHARSETS=all\

-DENABLED_LOCAL_INFILE=1\

-DMYSQL_UNIX_ADDR=/tmp/mysql3306.sock\

-DMYSQL_TCP_PORT=3306

#-DWITH_SYSTEMD=1\ remove this, plus mysqld_safe will not be installed

7. Compile

Make

8. Installation

Make install

9. Configure mysql parameters

Vim / apps/conf/mysql/mysql57_3306.cnf

Chown-R apps:apps / apps

Chmod-R 755 / apps

10. Initialize the database: (--there can be no data files in the datadir target directory)

/ apps/svr/mysql57/bin/mysqld-defaults-file=/apps/conf/mysql/mysql57_3306.cnf-initialize-user=apps

/ apps/svr/mysql57/bin/mysqld-- defaults-file=/apps/conf/mysql/mysql57_3306.cnf-- initialize-insecure-- user=apps # root password is empty

/ * *

1) initialize with the default configuration file

/ apps/svr/mysql5/bin/mysqld-initialize-user=apps-basedir=/apps/svr/mysql57-datadir=/apps/dbdat/mysql57_data3306 # MySQL 5.7.6 and up mysql_install_db-user=mysql # Before MySQL 5.7.6

2) initialize with a custom configuration file

/ apps/svr/mysql57/bin/mysqld-- defaults-file=/apps/conf/mysql/mysql57_3306.cnf-- initialize-- user=mysql # if initialized through a configuration file,-- defaults-file must be placed in the first location (before-- initialize), but the binlog directory cannot put a data directory

3) initialize but do not set the root password, the root password is empty

/ apps/svr/mysql57/bin/mysqld-defaults-file=/apps/conf/mysql/mysql57_3306.cnf-initialize-insecure-user=mysql

* * /

11. After executing this sentence, mysql will assign an initial password, which needs to be backed up.

Continue to execute:

/ apps/svr/mysql57/bin/mysql_ssl_rsa_setup

13. Start MySQL:

Nohup / apps/svr/mysql57/bin/mysqld_safe-defaults-file=/apps/conf/mysql/mysql57_3306.cnf-user=apps &

/ * *

Bin/mysqld_safe-- user=mysql &

Or

/ usr/local/mysql/support-files/mysql.server start

Or

Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld

Chmod + x / etc/init.d/mysqld

Chkconfig-add mysqld

You can use service mysqld start | restart | status | status management

You can also use systemctl start | restart | status | status mysqld.service

* * /

14. Log in to mysql

Mysql

15. Modify the password

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

16. Log in again

Mysql-uroot-p

On the mysql5.7forcentos7.6 source code installation steps are shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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