su - mysql -c “mysqld_safe –skip-name-resolve –open-files-limit=4096”
cd /usr/local/mysql/bin/ mysqldump -u用戶名 -p密碼 –databases 庫名 >/backdata/ddd07-11-15.sql
mysqldump –databases zt >/data/ok1.sql cd /usr/local/mysql/bin/ mysql -uroot -pueoadir zt/backdata/kb.sql mysqldump -uroot -pueoadir –databases zt >/backdata/back1210.sql
su - mysql -c “mysqld_safe –skip-name-resolve –open-files-limit=4096” cd /usr/local/mysql/bin/ mysql -uroot -pueoadir zt4/backdata/new.sql mysql -uroot -pueoadir zt/data/ok.sql UE處理下負區(qū)導入的表 mysql FLServer/data/FLServer.sql mysql GMTool/data/GMTool.sql mysql LoginServer/data/LoginServer.sql mysql roleChangeServer/data/roleChangeServer.sql mysql roleregServer/data/roleregServer.sql mysql unify00/data/unify00.sql
mysql FLServer/data/FLServer.sql mysql GMTool/data/GMTool.sql mysql LoginServer/data/LoginServer.sql mysql roleChangeServer/data/roleChangeServer.sql mysql roleregServer/data/roleregServer.sql mysql unify00/data/unify00.sql
mysql FLServer/data/FLServer.sql
mysql zt/data/zt501.sql mysql -uroot -pueoadir zt/backdata/kb.sql 查詢 select * from zt4.CHARBASE where name in (select name from zt.zHARBASE)
select * from CHARBASE limit 100 select UNIONID from CHARBASE limit 100
更新 update zt4.CHARBASE set name=CONCAT('一區(qū)',rtrim(name)) where name in (select name from zt.CHARBASE) ‘處理重名
update CHARBASE set name=CONCAT(rtrim(name),'1q')
update CHARBASE set CHARID=CHARID+10
插入 insert into zt.CHARBASE SELECT * FROM zt4.CHARBASE insert into game.user(name,pass) select name,pass from game2.user2
導入 mysql -uroot -pueoadir zt/backdata/zt2q.sql mysql -uroot -pueoadir zt/backdata/1q.sql
刪除 delete from CHARBASE WHERE ROUND=0 AND LEVEL 80 and `LASTACTIVEDATE` ‘2007-11-19 00:00:00′ delete from CHARBASE WHERE ROUND=0 AND ONLINETIME4962 and `LASTACTIVEDATE` ‘2007-11-19 00:00:00′
1.刪除玩家離線時間超過五天且在線時間小于1小時的玩家! delete from zt.CHARBASE WHERE ROUND=0 AND ONLINETIME4962 and `LASTACTIVEDATE` ‘2007-12-10 00:00:00′
delete from zt.CHARBASE WHERE ROUND=0 AND LEVEL80 and `LASTACTIVEDATE` ‘2007-11-22 00:00:00′ 2.去除GM CHARID編號重復 SELECT max(CHARID) FROM `CHARBASE`
update zt4.CHARBASE set CHARID=CHARID+10000 where CHARID 100 LIMIT 50 update zt4.CHARBASE set CHARID=CHARID+20000 where CHARID in (select CHARID from zt.CHARBASE)
3.去除人物重名 update zt4.CHARBASE set name=CONCAT(rtrim(name),'o') where name in (select name from zt.CHARBASE)
4.插入表2數(shù)據(jù)到表1
insert into zt.CHARBASE SELECT * FROM zt4.CHARBASE
________________________________________________ delete from zt4.CHARBASE WHERE ROUND=0 AND ONLINETIME4962 and `LASTACTIVEDATE` ‘2007-11-22 00:00:00′ delete from zt4.CHARBASE WHERE ROUND=0 AND LEVEL96 and `LASTACTIVEDATE` ‘2007-12-10 00:00:00′ SELECT max(CHARID) FROM zt4.CHARBASE select * from zt4.CHARBASE limit 100 update zt4.CHARBASE set CHARID=CHARID+10000 where CHARID in (select CHARID from zt.CHARBASE) update zt4.CHARBASE set name=CONCAT(rtrim(name),'oo') where name in (select name from zt.CHARBASE)
insert into zt.CHARBASE SELECT * FROM zt4.CHARBASE ___________________________________________________________________________________ 1.刪除玩家離線時間超過五天且在線時間小于1小時的玩家! delete from zt.CHARBASE WHERE ROUND=0 AND ONLINETIME4962 and `LASTACTIVEDATE` ‘2007-11-22 00:00:00′ delete from zt4.CHARBASE WHERE ROUND=0 AND ONLINETIME4962 and `LASTACTIVEDATE` ‘2007-11-22 00:00:00′ delete from zt.CHARBASE WHERE ROUND=0 AND LEVEL80 and `LASTACTIVEDATE` ‘2007-11-22 00:00:00′ delete from zt4.CHARBASE WHERE ROUND=0 AND LEVEL80 and `LASTACTIVEDATE` ‘2007-11-22 00:00:00′
2.CHARBASE表里CHARID處理重復 重復ID 前加10000
update zt4.CHARBASE set zt4.CHARBASE.CHARID=zt4.CHARBASE.CHARID+10000 where zt4.CHARBASE.CHARID in (select CHARID from zt.CHARBASE) CARTOONPET表里CARTOONID與主庫CARTOONPET重復的處理 update zt4.CARTOONPET set zt4.CARTOONPET.CARTOONID=zt4.CARTOONPET.CARTOONID+10000 where zt4.CARTOONPET.CARTOONID in (SELECT zt4.CARTOONPET.CARTOONID from zt.CARTOONPET)
3.SEPT表里SEPTID 處理重復,重復ID前加10000 update zt4.SEPT,zt.SEPT set zt4.SEPT.SEPTID= zt4.SEPT.SEPTID+10000 where zt4.SEPT.SEPTID in (select SEPTID from zt.SEPT)
4.UNIONMEMBER表里UNIONID處理重復前加10000
update zt4.UNIONMEMBER set zt4.UNIONMEMBER.UNIONID= zt4.UNIONMEMBER.UNIONID+10000 where zt4.UNIONMEMBER.UNIONID in (select UNIONID from zt.UNIONMEMBER)
5.UNIONMEMBER表里SEPTID 與SEPT表里的同步 update zt4.UNIONMEMBER,zt4.SEPT set zt4.UNIONMEMBER.SEPTID=zt4.SEPT.SEPTID WHERE zt4.UNIONMEMBER.NAME=zt4.SEPT.MASTER 6.UNION表里UNIONID 與UNIONMEMBER表里的同步 update zt4.UNION,zt4.UNIONMEMBER set zt4.UNION.UNIONID=zt4.UNIONMEMBER.UNIONID WHERE zt4.UNION.MASTER=zt4.UNIONMEMBER.NAME
7.SEPT表里UNIONID 與UNIONMEMBER表里的同步
update zt4.SEPT,zt4.UNIONMEMBER set zt4.SEPT.UNIONID=zt4.UNIONMEMBER.UNIONID WHERE zt4.SEPT.MASTER=zt4.UNIONMEMBER.NAME
8.CHARBASE表里SEPTID處理與SEPT表一致 update zt4.CHARBASE,zt4.SEPT set zt4.CHARBASE.SEPTID=zt4.SEPT.SEPTID WHERE zt4.CHARBASE.NAME=zt4.SEPT.NAME 9.CHARBASE表里UNIONID處理與UNIONMEMBER的UNIONID表一致 update zt4.CHARBASE,zt4.UNIONMEMBER set zt4.CHARBASE.UNIONID=zt4.UNIONMEMBER.UNIONID WHERE zt4.CHARBASE.NAME=zt4.UNIONMEMBER.NAME 10.SEPT表里CHARID與CHARBASE里的CHARID一致 update zt4.CHARBASE,zt4.SEPT set zt4.SEPT.CHARID=zt4.CHARBASE.CHARID WHERE zt4.CHARBASE.NAME=zt4.SEPT.MASTER CARTOONPET表里MASTERID與CHARBASE里的CHARID一致 update zt4.CARTOONPET,zt4.CHARBASE set zt4.CARTOONPET.MASTERID=zt4.CHARBASE.CHARID where zt4.CHARBASE.NAME=zt4.CARTOONPET.MASTERNAME 12.UNIONMEMBER表里CHARID與CHARBASE里的CHARID一致 update zt4.CHARBASE,zt4.UNIONMEMBER set zt4.UNIONMEMBER.CHARID=zt4.CHARBASE.CHARID WHERE zt4.CHARBASE.NAME=zt4.UNIONMEMBER.NAME
13.SCHOOLMEMBER表里CHARID與CHARBASE里的CHARID一致 update zt4.CHARBASE,zt4.SCHOOLMEMBER set zt4.SCHOOLMEMBER.CHARID=zt4.CHARBASE.CHARID WHERE zt4.CHARBASE.NAME=zt4.SCHOOLMEMBER.NAME
14.CHARBASE表里NAME與主庫CHARBASE名字重復的處理
update zt4.CHARBASE set name=CONCAT(rtrim(name),'oo') where name in (select name from zt.CHARBASE)
15.SEPT表里NAME與主庫SEPT名字重復的處理
update zt4.SEPT set zt4.SEPT.NAME=CONCAT(rtrim(zt4.SEPT.NAME),'oo') where zt4.SEPT.NAME in (select NAME from zt.SEPT)
16.UNION表里NAME與主庫UNION名字重復的處理 update zt4.UNION set zt4.UNION.NAME=CONCAT(rtrim(zt4.UNION.NAME),'oo') where zt4.UNION.NAME in (select NAME from zt.UNION)
17.SCHOOLMEMBER表里SERIALID與主庫SCHOOLMEMBER名字重復的處理 update zt4.SCHOOLMEMBER set zt4.SCHOOLMEMBER.SERIALID=zt4.SCHOOLMEMBER.SERIALID+10000 where zt4.SCHOOLMEMBER.SERIALID in (select SERIALID from zt.SCHOOLMEMBER) 18.SEPT表里MASTER人物名與CHAREBASE里的人物名同步 update zt4.CHARBASE,zt4.SEPT set zt4.SEPT.MASTER=zt4.CHARBASE.NAME WHERE zt4.CHARBASE.CHARID=zt4.SEPT.CHARID
19.SCHOOLMEMBER表里NAME與CHARBASE人物名同步 update zt4.CHARBASE,zt4.SCHOOLMEMBER set zt4.SCHOOLMEMBER.NAME=zt4.CHARBASE.NAME WHERE zt4.CHARBASE.CHARID=zt4.SCHOOLMEMBER.CHARID
20.UNION表里MASTER人物名與CHAREBASE里的人物名同步 update zt4.CHARBASE,zt4.UNION set zt4.UNION.NAME=zt4.CHARBASE.NAME WHERE zt4.CHARBASE.CHARID=zt4.UNION.CHARID 22.CARTOONPET表里MASTERNAME與CHAREBASE里的人物名同步 update zt4.CHARBASE,zt4.CARTOONPET set zt4.CARTOONPET.MASTERNAME=zt4.CHARBASE.NAME WHERE zt4.CHARBASE.CHARID=zt4.CARTOONPET.MASTERID
21.合并CHARBASE數(shù)據(jù)庫 insert into zt.CHARBASE SELECT * FROM zt4.CHARBASE 22.合并SCHOOLMEMBER數(shù)據(jù)庫 insert into zt.SCHOOLMEMBER SELECT * FROM zt4.SCHOOLMEMBER 23.合并SEPT數(shù)據(jù)庫 insert into zt.SEPT SELECT * FROM zt4.SEPT
24.合并UNIONMEMBER數(shù)據(jù)庫
insert into zt.UNIONMEMBER SELECT * FROM zt4.UNIONMEMBER
25.合并UNION insert into zt.UNION SELECT * FROM zt4.UNION
26.合并CARTOONPET insert into zt.CARTOONPET SELECT * FROM zt4.CARTOONPET
26.合并BALANCE insert into zt.BALANCE SELECT * FROM zt4.BALANCE