[臬榜/ V- h$ T! x. M* ~8 u6 z! L/ o
mysqldump -u userid -e -p db_Name > xxxxx.sql; L) X( Z A: ~7 R
臬箔table:mysqldump -p -u userid dbname tablename > 52avtv_dzx20.201506242307.sql$ t+ c, z+ J9 h: `9 @& Y, x
臬箸鞈摨: mysqldump -p -u userid --all-databases > all-database.sql
6 `8 d9 ]: d; m$ o2 V 雿,臬啁桃鞈摨怎雿輻刻撣唾撖蝣潭憿,隞仿舀鞈摨怠交,雿輻刻撣唾銋亙臬箸頛摰. E( Y/ b u# u2 E
[芸臬箇瑽] : https://iter01.com/206843.html
$ K3 c! a7 E! e6 Emysqldump--opt-d鞈摨怠-uroot-p>xxx.sql) O" h' I7 w0 X9 n0 X1 }- n( T
[芸臬箄]
0 L. o U4 \8 X# }- E6 B# ~( @- `mysqldump-t鞈摨怠-uroot-p>xxx.sql$ O2 A% Q- Y. f% @' o8 z1 H: `
1 c5 L/ Q- C2 y瘜冽: 嗡誑銝餈唳隞文隞賣蝬脩箇 "502 bad gateway",敶梢踹迸ginx,芾 --single-transaction --quick 撠勗末鈭,憒銝:
$ {1 k/ F# w2 O* }+ w0 Omysqldump -u userid -e -p --single-transaction --quick db_Name > xxxxx.sql
F3 i) t. Y; @; n憿:mysqldump: Got error: 1017: Can't find file: 'pre_forum_rsscache' (errno: 2) when using LOCK TABLES! [- ~3 N$ l% ^; j# ^
Sol: 芾皂ysqldump銝--lock-tables=false撠勗臭誑閫瘙箏憿
1 t9 `8 l' [+ D亥箇: mysqldump: Couldn't execute 'show create table `pre_forum_rsscache`': Can't find file: 'pre_forum_rsscache' (errno: 2) (1017),隞叼hpmyadmin餃交亦餌pre_forum_rsscache 雿輻其葉ls /var/lib/mysql/52avtv_dz/pre_forum_rsscache* 潛曉芣 pre_forum_rsscache.frm 1瑼獢 ,甇撣豢閰脰3瑼:
! M- S3 |9 }3 }/ Z3 f-rw-rw---- 1 mysql mysql 8852 Jun 3 16:05 pre_forum_rsscache.frm- a' B3 t0 {7 g, s, q' w* x
-rw-rw---- 1 mysql mysql 0 Jun 3 16:05 pre_forum_rsscache.MYD
: _1 g8 I: N' d' q7 A-rw-rw---- 1 mysql mysql 1024 Jun 3 16:05 pre_forum_rsscache.MYI7 G! q: l+ R% J& S2 `& B
Sol: * _4 F9 u7 U9 R' m9 j* Q
私hpmyadmin ==SQL 銝隞:
% U6 P7 H% O1 ~, O+ Q/ `/ H- DROP TABLE IF EXISTS pre_forum_rsscache;
- CREATE TABLE pre_forum_rsscache (
- lastupdate int(10) unsigned NOT NULL DEFAULT '0',
- fid mediumint(8) unsigned NOT NULL DEFAULT '0',
- tid mediumint(8) unsigned NOT NULL DEFAULT '0',
- dateline int(10) unsigned NOT NULL DEFAULT '0',
- forum char(50) NOT NULL DEFAULT '',
- author char(15) NOT NULL DEFAULT '',
- `subject` char(80) NOT NULL DEFAULT '',
- description char(255) NOT NULL DEFAULT '',
- guidetype char(10) NOT NULL DEFAULT '',
- UNIQUE KEY tid (tid),
- KEY fid (fid,dateline)
- ) ENGINE=MYISAM DEFAULT CHARSET=utf8
銴鋆賭誨蝣 + o. Z0 H/ V' D( D
隞賢停甇撣訾 L: d1 `1 M- M
憿: 嗡蝙皂ariadb 5.5.68 隞賣箇頡rror:mysqldump: Couldn't execute 'SHOW TRIGGERS LIKE 'pre\_portal\_topic\_pic'': Can't read dir of './db_name/' (errno: 24) (1018)9 Q3 u" N* W9 s. k
Sol: open_files_limit(default=962) 憭芸,寧4096,望澆撅祆廝ead-only,/etc/my.cnf
0 o8 e# O& n# N0 f5 Y嗅 service mariadb restart$ x+ T/ G0 t5 H/ b% M
+ z( U4 `. T, @; T$ l/ m[璇隞嗅臬榜
5 X& [6 D4 L* }mysqldump -u撣唾 -p撖蝣 -h銝餅 鞈摨 鞈銵 -w "sql璇隞" > 箄撓頝臬瑼獢
; L& V, r/ {) t5 i( V4 Z: J5 o: i' Y靘:1 ?" C" \$ c b) M+ K, s% i2 Y
mysqldump -uroot -p123456 -hlocalhost -e AREA_UTF8 city -w "c_id<10 " > /home/web/a.txt9 ]* l' t1 v# x, w& W
, K/ r- b8 o- Q9 y9 {6 F--no-create-info嚗-t8 f2 {9 P' c9 B$ X: R8 r. t/ t+ u
芸箄嚗銝瘛餃 CREATE TABLE 隤伐憒撠箸澆搴QL隤伐芣insert into典
3 e! t h6 ^* t o+ A2 u--no-data嚗-d v# R2 j& c2 v8 i% ^1 `
銝撠箔遙雿鞈嚗芸箄摨怎瑽
: J; g4 k2 W6 N4 ~$ i$ w--quick嚗-q ! Q" k$ W& b- p/ k9 r6 f0 m6 \
典箏之鞈敺剁撘瑕嗅 MySQL Server 亥岷敺閮湔亥撓綽銝臬敺閮敺摮刻園銝准
) z7 B) l/ x* U4 b6 ?" v5 |. Y# W; `- D/ b- a7 U
+ H! U! J1 M/ Z" \" H+ s( B
[臬包0 t& a" k" K ?6 c" ~
mysql -u userid -p [-h localhost] db_Name < xxxxx.sql
% ?' g) z8 f1 @9 R臬交鞈摨: mysql -u userid -p < all-database.sql
) c' ?5 d- O7 c2 v. [# ?$ v臬乩table :
2 D) ~$ S: Y. Q, [* A# kmysql -u userid -p -D dbname < cc5278_dzx20.ip2c.201506242307.sql
4 R" y$ _$ f" ^ j* _2 w, Z+ V+ AP.S憒臬交憭芸之憒7GB,臬交獢銋瑁銝隞:
4 J+ J3 M0 O9 K: o7 I: h" umysql -uroot -p -e "set global net_buffer_length=1000000; set global max_allowed_packet=1000000000;". w! L) b. |+ x1 G+ C. Z8 Z
0 M5 c- Y0 } Y+ c; M9 j. P3 Y[臬箏蝡喳臬亙啣虫唬蜓璈]- @4 B1 p* v- q9 J0 O. E' F* K9 j
mysqldump -u [SOURCE_userid] -h [SOURCE_IP] -e -q --password=[SOURCE_PASSWORD] SOURCE_db_Name | mysql -u [DISTANCE_userid] --password=[DISTANCE_PASSWORD] -h [DISTANCE_IP] DISTANCE_db_Name : Z! }& x# b' R
[閮剖臬乩(批2Mb) by phpmyadmin]% O# g# F3 a+ W6 R: x0 ?4 o
http://www.av4u.info/forum.php?m ... e=1&extra=#pid20348
5 `: l1 u% l s, r: w1 l( s
p; k1 Y1 Q! z: S( s |5 ~4 q0 T b6 v( u, g2 r$ \. @. i: A
# A, u3 j: i+ y& Y* r5 m1 P
1 k* \7 n8 o4 q8 Q' a/ U7 k$ X) L7 m; {' a- m$ @5 T$ ]
9 Z2 K1 D% F. U* f' C
) l4 p: N, H& V% M: p# F
5 E1 j2 j$ A. c0 `" k G$ {( E
( i0 z+ o: [& |, y% W
, m& C! C% t l# G
; N/ D4 [' _' Q, z3 c- w+ n& L: |$ e" T9 M9 F, y5 H5 {4 ?. j
) e' E- F: ^$ S$ u
/ N6 E; j7 [8 b& M. L |
|