主頁(yè) > 知識(shí)庫(kù) > centos7.2離線安裝mysql5.7.18.tar.gz

centos7.2離線安裝mysql5.7.18.tar.gz

熱門(mén)標(biāo)簽:天津公司外呼系統(tǒng)軟件 徐涇鎮(zhèn)騰訊地圖標(biāo)注 昌德訊外呼系統(tǒng) 中國(guó)地圖標(biāo)注公司 自己做地圖標(biāo)注需要些什么 電話機(jī)器人的價(jià)格多少錢(qián)一個(gè)月 400電話申請(qǐng)廠家現(xiàn)貨 百度地圖標(biāo)注要什么軟件 福建外呼電銷(xiāo)機(jī)器人加盟

因?yàn)榫W(wǎng)絡(luò)隔離,無(wú)法使用yum方式安裝mysql,這里介紹linux服務(wù)器上手動(dòng)離線安裝mysql的方法。

目的

離線安裝mysql服務(wù)
服務(wù)器:centos7.2,配置本地yum源
mysql版本:mysql5.7.18

步驟

1.下載安裝包mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz,安裝包傳輸?shù)侥康姆?wù)器/tmp目錄
2.my.cnf文件(見(jiàn)文末)傳輸?shù)侥康姆?wù)器的/tmp目錄
3.創(chuàng)建用戶(hù)和相應(yīng)文件夾:

# 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.安裝

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/
# 初始化數(shù)據(jù)庫(kù),
cd /apps/mysql
./bin/mysqld --initialize --user=mysql --basedir=/apps/mysql/ --datadir=/data/mysql7006/data/

初始化過(guò)程中會(huì)生成一個(gè)默認(rèn)密碼記得記下來(lái),后續(xù)修改用。

5.注冊(cè)service(可以不做)

# 依據(jù)情況修改support-files/mysql.server
cp support-files/mysql.server /etc/init.d/mysql
systemctl start mysql.service

# 添加開(kāi)機(jī)啟動(dòng)
chkconfig mysql.server on

6.啟動(dòng)數(shù)據(jù)庫(kù)/apps/mysql/bin/mysqld_safe --defaults-file=/apps/mysql/my.cnf

7.修改默認(rèn)密碼:

/apps/mysql/bin/mysqladmin -u root password 'password' --port=7006 --socket=/data/mysql7006/mysql.sock -p
# 修改后清空l(shuí)inux的history記錄
history -c

# 登陸測(cè)試:
/apps/mysql/bin/mysql -u root --port=7006 --socket=/data/mysql7006/mysql.sock -p

8.防火墻、賦權(quán)(按需做)

# 防火墻
firewall-cmd --zone=public --add-port=7006/tcp --permanent
systemctl restart firewalld
firewall-cmd --zone=public --query-port=7006/tcp
# 賦權(quán)給登陸用戶(hù)
use mysql;
grant all privileges on *.* to user@'ip' identified by "password";
flush privileges;
select host,user,password from user;

9.本地隱藏密碼登錄(可以不做)

## 使用mysql_config_editor 制作登錄文件
/apps/mysql/bin/mysql_config_editor set --login-path=root_pass --user=root --port=7006 --socket=/data/mysql7006/mysql.sock --password
## 輸入密碼:******
## 文件會(huì)加密存儲(chǔ)于用戶(hù)根目錄下.mylogin.cnf
/apps/mysql/bin/mysql_config_editor print --all
## 下次登錄時(shí)直接敲:
/apps/mysql/bin/mysql --login-path=root_pass

# 再省事一些:set alias
# 打開(kāi)file .bashrc,添加
alias db7006='/apps/mysql/bin/mysql --login-path=root_pass'
# 然后退出執(zhí)行:
source .bashrc
## 下次登錄時(shí)直接敲:
db7006

附錄

my.cnf文件

主要功能:全局utf8字符集、自定義端口、數(shù)據(jù)文件夾、日志文件夾、默認(rèn)引擎innodb(支持事務(wù),對(duì)xtrabackup友好)、跳過(guò)客戶(hù)端登陸時(shí)的dns解析

[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'

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

您可能感興趣的文章:
  • centos7.0安裝離線JDK1.8方法詳解
  • centos 6.4下使用rpm離線安裝mysql
  • CentOS 安裝 Mogodb的步驟(在線&&離線兩種)
  • CentOS 離線安裝gcc(版本4.8.2)詳細(xì)介紹
  • CentOS 安裝 Mongodb詳解(在線和離線)
  • CentOS/RedHat 6.5 離線安裝Docker
  • CentOS7離線安裝MySQL的教程詳解

標(biāo)簽:荊門(mén) 陜西 駐馬店 昌都 鄂爾多斯 梅河口 黔西 北京

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《centos7.2離線安裝mysql5.7.18.tar.gz》,本文關(guān)鍵詞  centos7.2,離線,安裝,mysql5.7.18.tar.gz,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《centos7.2離線安裝mysql5.7.18.tar.gz》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于centos7.2離線安裝mysql5.7.18.tar.gz的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章