MySQL 5.7手動安裝步驟

MySQL 5.7手動安裝步驟

一扰魂,下載

1.1 下載地址

https://dev.mysql.com/downloads/mysql/

download :https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz

1.2 mysql主配置信息

內(nèi)存:2-4G

二店溢,安裝配置

2.1 解壓安裝文件到/usr/local/

cd /usr/local/

tar xf mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz -C /usr/local

mkdir /usr/local/mysql

unlink /usr/local/mysql

ln -fs /usr/local/mysql-5.7.29-linux-glibc2.12-x86_64 /usr/local/mysql

2.2 創(chuàng)建數(shù)據(jù)目錄&mysql用戶

mkdir -p /data/mysql/3306/{data,binlog,relaylog,dblog,tmp}

touch /data/mysql/3306/dblog/error.log

useradd mysql

chown -R mysql.mysql /data/mysql/3306

2.3 創(chuàng)建配置文件到

vim /data/mysql/3306/my.cnf

[client]

port = 3306

socket = /data/mysql/3306/mysql.sock

[mysql]

no-auto-rehash

#prompt = "\\u@\\d \\R:\\m> "

prompt = "\\u@\\h : \\d \\R:\\m:\\s> "

character-set-server = utf8mb4

# The MySQL server

#########Basic##################

[mysqld]

server-id = 883306

port = 3306

user = mysql

basedir = /usr/local/mysql

datadir = /data/mysql/3306/data

socket = /data/mysql/3306/mysql.sock

pid-file = /data/mysql/3306/mysql.pid

skip-external-locking

skip-name-resolve

default-storage-engine = InnoDB

character-set-client-handshake = FALSE?

character-set-server = utf8mb4

init_connect='set names utf8mb4'

#wait_timeout = 200

#interactive_timeout = 200

connect_timeout = 20

back_log = 1000

log_bin_trust_function_creators = 1

lower_case_table_names = 1

#read_only = 1

sql_mode = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

secure_file_priv = '/data/mysql/3306/tmp'

transaction_isolation = READ-COMMITTED

#######: for per_thread_buffers ############

max_connections = 1000

#max_user_connections = 1000

max_connect_errors = 10000000

key_buffer_size = 16M

max_allowed_packet = 128M

thread_cache_size = 320

thread_stack = 256K

table_open_cache = 6144

table_definition_cache = 4096

table_open_cache_instances = 64

sort_buffer_size = 512K

read_buffer_size = 512K

read_rnd_buffer_size = 512k

join_buffer_size = 512K

tmp_table_size = 64M

max_heap_table_size = 128M

query_cache_type = 0

query_cache_size = 0

bulk_insert_buffer_size = 32M

#max_prepared_stmt_count = 1048576

######### : for binlog ##################

log-bin = /data/mysql/3306/binlog/mysql-bin

binlog_format = row

binlog_rows_query_log_events = on

log_slave_updates = 1

max_binlog_size = 512M

binlog_cache_size = 65535

expire-logs-days = 7

sync_binlog = 1

slave-preserve-commit-order = ON

relay-log = /data/mysql/3306/relaylog/mysql-relay

#########: for replication #############

slave-net-timeout = 20

skip-slave-start

sync_master_info = 1

sync_relay_log_info = 1

relay_log_recovery = 1

#slave-parallel-type=LOGICAL_CLOCK

#slave-parallel-workers=16

master_info_repository=TABLE

relay_log_info_repository=TABLE

#########: for slow log #############

slow_query_log = 1

slow_query_log_file = /data/mysql/3306/dblog/mysql.slow

log_queries_not_using_indexes = on

long_query_time = 2

#########: for error log #############

log-error = /data/mysql/3306/dblog/error.log

general_log = off

#########: for gtid#############

#gtid_executed_compression_period = 1000

#gtid_mode = on

#enforce_gtid_consistency = on

#########: for InnoDB #############

#5.7.29 廢棄了

#default_stroage_engine = innodb

#default_tmp_stroage_engine = innodb

innodb_data_home_dir = /data/mysql/3306/data

innodb_data_file_path = ibdata1:128M:autoextend

innodb_temp_data_file_path = ibtmp1:1024M:autoextend:max:5G

innodb_buffer_pool_size = 1G

innodb_log_file_size = 200M

innodb_log_buffer_size = 128M

innodb_log_files_in_group = 2

innodb_thread_concurrency = 0

innodb_max_dirty_pages_pct = 85

innodb_support_xa = 0

innodb_flush_log_at_trx_commit = 0

innodb_flush_method = O_DIRECT

innodb_read_io_threads = 8

innodb_write_io_threads = 8

innodb_io_capacity = 200

innodb_io_capacity_max = 2000

#----ssd

#innodb_io_capacity = 2000

#innodb_flush_neighbors = 0

#innodb_page_size = 8K

#innodb_log_block_size = 4096

innodb_file_per_table = 1

innodb_file_format = Barracuda

innodb_file_format_max = Barracuda

innodb_strict_mode = 1

innodb_purge_threads = 4

innodb_page_cleaners=4

innodb_purge_batch_size = 32

innodb_print_all_deadlocks = on

innodb_deadlock_detect = on

innodb_lock_wait_timeout = 50

innodb_spin_wait_delay = 6

innodb_autoinc_lock_mode = 2

innodb_stats_on_metadata = off

innodb_checksum_algorithm=crc32

innodb_open_files = 65535

#metadata_locks_hash_instances=32

innodb_online_alter_log_max_size = 128M

#-----Persistent Optimizer Statistics

innodb_stats_auto_recalc = on

innodb_stats_persistent = on

innodb_stats_persistent_sample_pages = 20

innodb_adaptive_hash_index = on

innodb_change_buffering = all

innodb_change_buffer_max_size = 25

innodb_flush_log_at_timeout = 1

innodb_flush_log_at_trx_commit = 1

#-----innodb scan resistant

innodb_old_blocks_pct = 37

innodb_old_blocks_time = 1000

#----innodb read ahead

innodb_read_ahead_threshold = 56

innodb_random_read_ahead = off

#-----innodb buffer pool state(5.7)

innodb_buffer_pool_dump_pct = 40

innodb_buffer_pool_dump_at_shutdown = ON

innodb_buffer_pool_load_at_startup = ON

innodb_undo_log_truncate = 1

innodb_max_undo_log_size = 2G

innodb_purge_rseg_truncate_frequency = 128

binlog_gtid_simple_recovery=1

binlog_error_action=ABORT_SERVER

log_timestamps=system

transaction_write_set_extraction=MURMUR32

show_compatibility_56=on

internal_tmp_disk_storage_engine=INNODB

eq_range_index_dive_limit=200

[mysqldump]

quick

max_allowed_packet = 512M

[mysqld_safe]

numa_interleave = 1

open-files-limit = 65535

2.4 初使化

/usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/3306/my.cnf --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/3306/data/

2.5 啟動服務(wù)

/usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/3306/my.cnf --user=mysql &

2.6 初始化密碼

這種安裝是無密碼本機登錄

/usr/local/mysql/bin/mysql -uroot -S /data/mysql/3306/mysql.sock

ln -fs /data/mysql/3306/mysql.sock /tmp

就不用每次 -S /data/mysql/3306/mysql.sock

其他安裝方式需要輸入密碼

/usr/local/mysql/bin/mysql -uroot -p

2.7 MySQL5.7 root開放遠程連接

例如胳喷,你想使用賬號username 使用密碼 password 從任何主機連接到mysql服務(wù)器的話品山。

GRANT ALL PRIVILEGES ON *.* TO 'root '@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

FLUSH? PRIVILEGES;

別忘了執(zhí)行語句 FLUSH RIVILEGES 使修改生效

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末局雄,一起剝皮案震驚了整個濱河市紧唱,隨后出現(xiàn)的幾起案子评甜,更是在濱河造成了極大的恐慌灰粮,老刑警劉巖,帶你破解...
    沈念sama閱讀 211,123評論 6 490
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件忍坷,死亡現(xiàn)場離奇詭異粘舟,居然都是意外死亡,警方通過查閱死者的電腦和手機佩研,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,031評論 2 384
  • 文/潘曉璐 我一進店門柑肴,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人旬薯,你說我怎么就攤上這事晰骑。” “怎么了绊序?”我有些...
    開封第一講書人閱讀 156,723評論 0 345
  • 文/不壞的土叔 我叫張陵硕舆,是天一觀的道長。 經(jīng)常有香客問我骤公,道長抚官,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 56,357評論 1 283
  • 正文 為了忘掉前任阶捆,我火速辦了婚禮凌节,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘趁猴。我一直安慰自己刊咳,他們只是感情好,可當我...
    茶點故事閱讀 65,412評論 5 384
  • 文/花漫 我一把揭開白布儡司。 她就那樣靜靜地躺著娱挨,像睡著了一般。 火紅的嫁衣襯著肌膚如雪捕犬。 梳的紋絲不亂的頭發(fā)上跷坝,一...
    開封第一講書人閱讀 49,760評論 1 289
  • 那天断医,我揣著相機與錄音敷扫,去河邊找鬼躏精。 笑死汰瘫,一個胖子當著我的面吹牛菱涤,可吹牛的內(nèi)容都是我干的物喷。 我是一名探鬼主播慕购,決...
    沈念sama閱讀 38,904評論 3 405
  • 文/蒼蘭香墨 我猛地睜開眼震桶,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了毫蚓?” 一聲冷哼從身側(cè)響起占键,我...
    開封第一講書人閱讀 37,672評論 0 266
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎元潘,沒想到半個月后畔乙,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,118評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡翩概,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,456評論 2 325
  • 正文 我和宋清朗相戀三年牲距,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片钥庇。...
    茶點故事閱讀 38,599評論 1 340
  • 序言:一個原本活蹦亂跳的男人離奇死亡牍鞠,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出上沐,到底是詐尸還是另有隱情皮服,我是刑警寧澤,帶...
    沈念sama閱讀 34,264評論 4 328
  • 正文 年R本政府宣布参咙,位于F島的核電站龄广,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏蕴侧。R本人自食惡果不足惜择同,卻給世界環(huán)境...
    茶點故事閱讀 39,857評論 3 312
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望净宵。 院中可真熱鬧敲才,春花似錦、人聲如沸择葡。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,731評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽敏储。三九已至阻星,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間已添,已是汗流浹背妥箕。 一陣腳步聲響...
    開封第一講書人閱讀 31,956評論 1 264
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留更舞,地道東北人畦幢。 一個月前我還...
    沈念sama閱讀 46,286評論 2 360
  • 正文 我出身青樓,卻偏偏與公主長得像缆蝉,于是被迫代替她去往敵國和親宇葱。 傳聞我的和親對象是個殘疾皇子瘦真,可洞房花燭夜當晚...
    茶點故事閱讀 43,465評論 2 348

推薦閱讀更多精彩內(nèi)容