centos7.2 offline installation mysql5.7.18.tar.gz

centos7.2 offline installation mysql5.7.18.tar.gz

Because of network isolation, MySQL cannot be installed using yum. Here is a method to manually install MySQL offline on a Linux server.

Purpose

Offline installation of MySQL service server: centos7.2, configure local yum source
mysql version:mysql5.7.18

step

1. Download the installation package mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz and transfer the installation package to the /tmp directory of the destination server
2. The my.cnf file (see the end of the article) is transferred to the /tmp directory of the destination server
3. Create users and corresponding folders:

# prepare
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
yum install -y autoconf
mkdir /apps
mkdir /logs
mkdir /data
mkdir -p /data/mysql7006/data && chown -R mysql:mysql /data/mysql7006
mkdir /logs/mysql7006 && chown -R mysql:mysql /logs/mysql7006
touch /logs/mysql7006/error-log.err && chown -R mysql:mysql /logs/mysql7006/error-log.err

4. Installation

cd /tmp
tar zxvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.7.18-linux-glibc2.5-x86_64 mysql
mv mysql /apps/mysql
cp my.cnf /apps/mysql/

chown -R mysql:mysql /apps/mysql/
# Initialize the database,
cd /apps/mysql
./bin/mysqld --initialize --user=mysql --basedir=/apps/mysql/ --datadir=/data/mysql7006/data/

A default password will be generated during the initialization process. Remember to write it down for later modification.

5. Register the service (optional)

# Modify support-files/mysql.server as needed
cp support-files/mysql.server /etc/init.d/mysql
systemctl start mysql.service

# Add startup chkconfig mysql.server on

6. Start the database /apps/mysql/bin/mysqld_safe --defaults-file=/apps/mysql/my.cnf &

7. Change the default password:

/apps/mysql/bin/mysqladmin -u root password 'password' --port=7006 --socket=/data/mysql7006/mysql.sock -p
# Clear the Linux history record after modification history -c

# Login test:
/apps/mysql/bin/mysql -u root --port=7006 --socket=/data/mysql7006/mysql.sock -p

8. Firewall, empowerment (as needed)

# Firewall firewall-cmd --zone=public --add-port=7006/tcp --permanent
systemctl restart firewalld
firewall-cmd --zone=public --query-port=7006/tcp
#Give the login user the right to use mysql;
grant all privileges on *.* to user@'ip' identified by "password";
flush privileges;
select host,user,password from user;

9. Local hidden password login (optional)

## Use mysql_config_editor to create a login file /apps/mysql/bin/mysql_config_editor set --login-path=root_pass --user=root --port=7006 --socket=/data/mysql7006/mysql.sock --password
## Enter password:******
## The file will be encrypted and stored in the user's root directory.mylogin.cnf
/apps/mysql/bin/mysql_config_editor print --all
## Next time you log in, just type:
/apps/mysql/bin/mysql --login-path=root_pass

# Make it easier: set alias
# Open file .bashrc, add alias db7006='/apps/mysql/bin/mysql --login-path=root_pass'
# Then exit execution:
source .bashrc
## Next time you log in, just type:
db7006

appendix

my.cnf File

Main functions: global utf8 character set, custom port, data folder, log folder, default engine innodb (supports transactions, friendly to xtrabackup), skip DNS resolution when client logs in

[client]
port=7006
default-character-set=utf8

[mysqld]
skip-name-resolve
secure_file_priv="/"
character-set-server=utf8
user=mysql
server_id=20180917
port=7006
socket=/data/mysql7006/mysql.sock
pid-file=/data/mysql7006/mysql.pid
basedir=/apps/mysql
datadir=/data/mysql7006/data
log-error=/logs/mysql7006/error-log
log-bin=/logs/mysql7006/bin-log

max_allowed_packet = 64M
default_storage_engine = InnoDB
innodb_strict_mode = 1
innodb_buffer_pool_size = 5G
innodb_stats_on_metadata = 0
innodb_file_format = Barracuda
innodb_flush_method = O_DIRECT
innodb_log_files_in_group = 2
innodb_log_file_size = 4G
innodb_log_buffer_size = 128M
innodb_file_per_table = 1
innodb_max_dirty_pages_pct = 60
innodb_io_capacity = 4000
lower_case_table_names = 1

#ADD INNODB
innodb_buffer_pool_instances = 16
innodb_flush_log_at_trx_commit = 1
innodb_adaptive_flushing = 1
innodb_thread_concurrency = 0
innodb_stats_persistent = 1
innodb_purge_threads = 4
innodb_use_native_aio = 1

##innodb_use_sys_malloc = 1
innodb_autoinc_lock_mode = 2
innodb_change_buffering = inserts
innodb_read_io_threads = 16
innodb_write_io_threads = 16
expire_logs_days = 30

# CACHES AND LIMITS #
key_buffer_size = 32M
tmp_table_size = 256M
max_heap_table_size = 256M

table_open_cache = 4096
query_cache_type = 0
query_cache_size = 0
max_connections = 2000
thread_cache_size = 1024
open_files_limit = 65535

#ADD OTHERS
metadata_locks_hash_instances = 256
table_open_cache_instances = 16
back_log = 1500

wait_timeout = 3600
interactive_timeout = 3600
master_info_repository=TABLE
relay_log_info_repository=TABLE
log_slave_updates=ON
binlog_checksum=NONE
binlog_format=ROW
transaction_isolation=READ-COMMITTED
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of how to install offline JDK1.8 on centos7.0
  • Install mysql offline using rpm under centos 6.4
  • CentOS installation steps for Mogodb (online &&offline)
  • CentOS offline installation of gcc (version 4.8.2) detailed introduction
  • Detailed installation of Mongodb in CentOS (online and offline)
  • CentOS/RedHat 6.5 Offline Installation of Docker
  • Detailed tutorial on installing MySQL offline on CentOS7

<<:  How to count down the date using bash

>>:  Vue sample code for easily implementing virtual scrolling

Recommend

Problems and solutions for installing Docker on Alibaba Cloud

question When installing Docker using Alibaba Clo...

Detailed explanation of the wonderful CSS attribute MASK

This article will introduce a very interesting at...

Detailed tutorial on using cmake to compile and install mysql under linux

1. Install cmake 1. Unzip the cmake compressed pa...

Solve the problem of Tomcat10 Catalina log garbled characters

Running environment, Idea2020 version, Tomcat10, ...

JS implementation of Apple calculator

This article example shares the specific code of ...

Docker deploys mysql remote connection to solve 2003 problems

Connecting to MySQL Here I use navicat to connect...

How to use CocosCreator object pool

Table of contents Preface: Specific operations St...

How to use axios request in Vue project

Table of contents 1. Installation 2. There is no ...

Implementing a puzzle game with js

This article shares the specific code of js to im...

Three ways to implement virtual hosts under Linux7

1. Same IP address, different port numbers Virtua...

A complete guide to some uncommon but useful CSS attribute operations

1. Custom text selection ::selection { background...

How to fix the WeChat applet input jitter problem

Find the problem Let's look at the problem fi...

Selection and thinking of MySQL data backup method

Table of contents 1. rsync, cp copy files 2. sele...

Detailed explanation of nmcli usage in CentOS8

Common nmcli commands based on RHEL8/CentOS8 # Vi...

How to limit the number of records in a table in MySQL

Table of contents 1. Trigger Solution 2. Partitio...