仓酷云
标题:
带来一篇Linux下mysql数据库文件全体丧失mysql没法启动
[打印本页]
作者:
活着的死人
时间:
2015-1-14 20:27
标题:
带来一篇Linux下mysql数据库文件全体丧失mysql没法启动
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们!
一夙兴来,发明数据目次下的mysql文件全体消散,一声盗汗,怎样回事!!???被黑了,仍是由于前两天重启办事器招致mysql数据丧失???这是怎样回事,上彀看看怎样办理,没找到办理计划!!!!看看mysql办事是否是开启的,
[root@pacteralinuxmysql]#ps-ef|grepmysqlroot53794291013:10pts/000:00:00grepmysql[root@pacteralinuxmysql]#servicemysqldstartStartingMySQL..TheserverquitwithoutupdatingPIDfile(/mnt/resource/mysqldate/pacteralinux.pid).[FAILED]
复制代码
,办事封闭,并且启动不了!看日记:
13112613:10:57mysqld_safeStartingmysqlddaemonwithdatabasesfrom/mnt/resource/mysqldate2013-11-2613:10:580[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).2013-11-2613:10:585650[Note]PluginFEDERATEDisdisabled./usr/local/mysql/bin/mysqld:Tablemysql.plugindoesntexist2013-11-2613:10:585650[ERROR]Cantopenthemysql.plugintable.Pleaserunmysql_upgradetocreateit.2013-11-2613:10:585650[Note]InnoDB:TheInnoDBmemoryheapisdisabled2013-11-2613:10:585650[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins2013-11-2613:10:585650[Note]InnoDB:Compressedtablesusezlib1.2.32013-11-2613:10:585650[Note]InnoDB:NotusingCPUcrc32instructions2013-11-2613:10:585650[Note]InnoDB:Initializingbufferpool,size=128.0M2013-11-2613:10:585650[Note]InnoDB:Completedinitializationofbufferpool2013-11-2613:10:585650[Note]InnoDB:Thefirstspecifieddatafile./ibdata1didnotexist:anewdatabasetobecreated!2013-11-2613:10:585650[Note]InnoDB:Settingfile./ibdata1sizeto12MB2013-11-2613:10:585650[Note]InnoDB:Databasephysicallywritesthefilefull:wait...2013-11-2613:10:585650[Note]InnoDB:Settinglogfile./ib_logfile101sizeto48MB2013-11-2613:10:585650[Note]InnoDB:Settinglogfile./ib_logfile1sizeto48MB2013-11-2613:10:585650[Note]InnoDB:Renaminglogfile./ib_logfile101to./ib_logfile02013-11-2613:10:585650[Warning]InnoDB:Newlogfilescreated,LSN=457812013-11-2613:10:585650[Note]InnoDB:Doublewritebuffernotfound:creatingnew2013-11-2613:10:585650[Note]InnoDB:Doublewritebuffercreated2013-11-2613:10:585650[Note]InnoDB:128rollbacksegment(s)areactive.2013-11-2613:10:595650[Warning]InnoDB:Creatingforeignkeyconstraintsystemtables.2013-11-2613:10:595650[Note]InnoDB:Foreignkeyconstraintsystemtablescreated2013-11-2613:10:595650[Note]InnoDB:Creatingtablespaceanddatafilesystemtables.2013-11-2613:10:595650[Note]InnoDB:Tablespaceanddatafilesystemtablescreated.2013-11-2613:10:595650[Note]InnoDB:Waitingforpurgetostart2013-11-2613:10:595650[Note]InnoDB:5.6.14started;logsequencenumber02013-11-2613:10:595650[Note]Serverhostname(bind-address):*;port:33062013-11-2613:10:595650[Note]IPv6isavailable.2013-11-2613:10:595650[Note]-::resolvesto::;2013-11-2613:10:595650[Note]ServersocketcreatedonIP:::.2013-11-2613:10:595650[ERROR]Fatalerror:Cantopenandlockprivilegetables:Tablemysql.userdoesntexist13112613:10:59mysqld_safemysqldfrompidfile/mnt/resource/mysqldate/pacteralinux.pidended[ERROR]Fatalerror:Cantopenandlockprivilegetables:Tablemysql.userdoesntexist:
复制代码
表初始化没做好;不论,下认识的删除日记看下能不克不及重启
1
2
3
4
5
6
7
8
9
10
11
[root@pacteralinuxmysqldate]#ll
total110640
-rw-rw----.1mysqlmysql56Nov2517:17auto.cnf
-rw-rw----.1mysqlmysql12582912Nov2613:15ibdata1
-rw-rw----.1mysqlmysql50331648Nov2613:15ib_logfile0
-rw-rw----.1mysqlmysql50331648Nov2613:10ib_logfile1
-rw-rw----.1mysqlroot39056Nov2613:15pacteralinux.err
[root@pacteralinuxmysqldate]#rmib*
rm:removeregularfile`ibdata1?y
rm:removeregularfile`ib_logfile0?y
rm:removeregularfile`ib_logfile1?y
不可,网上看看能不克不及规复数据,无办理计划!!
幸亏这时候一个mysql从办事器(我做了一个主从mysql热备份)!!!没举措,数据规复不了就从头在复制一份吧!
上述步调后仍是不克不及启动数据
尝尝从头初始化:
[root@pacteralinuxmysqldate]#/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql/data/--datadir=/mnt/resource/mysqldate/FATALERROR:Couldnotfind./bin/my_print_defaultsIfyoucompiledfromsource,youneedtorunmakeinstalltocopythesoftwareintothecorrectlocationreadyforoperation.Ifyouareusingabinaryrelease,youmusteitherbeatthetopleveloftheextractedarchive,orpassthe--basediroptionpointingtothatlocation.[root@pacteralinuxmysqldate]#cd/usr/local/mysql/bin/[root@pacteralinuxmysql]#/usr/local/mysql/scripts/mysql_install_db--user=mysql--no-defaultsInstallingMySQLsystemtables...2013-11-2613:20:420[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).2013-11-2613:20:426036[Note]InnoDB:TheInnoDBmemoryheapisdisabled2013-11-2613:20:426036[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins2013-11-2613:20:426036[Note]InnoDB:Compressedtablesusezlib1.2.32013-11-2613:20:426036[Note]InnoDB:NotusingCPUcrc32instructions2013-11-2613:20:426036[Note]InnoDB:Initializingbufferpool,size=128.0M2013-11-2613:20:426036[Note]InnoDB:Completedinitializationofbufferpool2013-11-2613:20:426036[Note]InnoDB:HighestsupportedfileformatisBarracuda.2013-11-2613:20:426036[Note]InnoDB:128rollbacksegment(s)areactive.2013-11-2613:20:426036[Note]InnoDB:Waitingforpurgetostart2013-11-2613:20:426036[Note]InnoDB:5.6.14started;logsequencenumber16006072013-11-2613:20:426036[Warning]InnoDB:Cannotopentablemysql/innodb_table_statsfromtheinternaldatadictionaryofInnoDBthoughthe.frmfileforthetableexists.Seehttp://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.htmlforhowyoucanresolvetheproblem.ERROR:1146Tablemysql.innodb_table_statsdoesntexist2013-11-2613:20:426036[ERROR]Aborting2013-11-2613:20:426036[Note]Binlogend2013-11-2613:20:426036[Note]InnoDB:FTSoptimizethreadexiting.2013-11-2613:20:426036[Note]InnoDB:Startingshutdown...2013-11-2613:20:446036[Note]InnoDB:Shutdowncompleted;logsequencenumber16006172013-11-2613:20:446036[Note]./bin/mysqld:Shutdowncomplete
复制代码
初始化不了,,删除之前初始化的文件尝尝
1
2
3
4
5
6
7
[root@pacteralinuxdata]#ll
total12
drwx------.2mysqlmysql4096Sep2512:27mysql
drwx------.2mysqlmysql4096Sep2512:27performance_schema
drwxr-xr-x.2mysqlmysql4096Sep2510:28test
[root@pacteralinuxdata]#cd..
[root@pacteralinuxmysql]#rm-rfdata/
从头初始化:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
[root@pacteralinuxmysql]#scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/mnt/resource/mysqldate--user=mysql
InstallingMySQLsystemtables...2013-11-2613:41:480[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).
2013-11-2613:41:486768[Note]InnoDB:TheInnoDBmemoryheapisdisabled
2013-11-2613:41:486768[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins
2013-11-2613:41:486768[Note]InnoDB:Compressedtablesusezlib1.2.3
2013-11-2613:41:486768[Note]InnoDB:NotusingCPUcrc32instructions
2013-11-2613:41:486768[Note]InnoDB:Initializingbufferpool,size=128.0M
2013-11-2613:41:486768[Note]InnoDB:Completedinitializationofbufferpool
2013-11-2613:41:486768[Note]InnoDB:HighestsupportedfileformatisBarracuda.
2013-11-2613:41:486768[Note]InnoDB:Logscanprogressedpastthecheckpointlsn49463
2013-11-2613:41:486768[Note]InnoDB:Databasewasnotshutdownnormally!
2013-11-2613:41:486768[Note]InnoDB:Startingcrashrecovery.
2013-11-2613:41:486768[Note]InnoDB:Readingtablespaceinformationfromthe.ibdfiles...
2013-11-2613:41:486768[Note]InnoDB:Restoringpossiblehalf-writtendatapages
2013-11-2613:41:486768[Note]InnoDB:fromthedoublewritebuffer...
InnoDB:Doingrecovery:scanneduptologsequencenumber1600617
2013-11-2613:41:486768[Note]InnoDB:Startinganapplybatchoflogrecordstothedatabase...
InnoDB:Progressinpercent:282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
InnoDB:Applybatchcompleted
2013-11-2613:41:486768[Note]InnoDB:128rollbacksegment(s)areactive.
2013-11-2613:41:486768[Note]InnoDB:Waitingforpurgetostart
2013-11-2613:41:486768[Note]InnoDB:5.6.14started;logsequencenumber1600617
2013-11-2613:41:546768[Note]Binlogend
2013-11-2613:41:546768[Note]InnoDB:FTSoptimizethreadexiting.
2013-11-2613:41:546768[Note]InnoDB:Startingshutdown...
2013-11-2613:41:556768[Note]InnoDB:Shutdowncompleted;logsequencenumber1625997
OK
Fillinghelptables...2013-11-2613:41:550[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).
2013-11-2613:41:556793[Note]InnoDB:TheInnoDBmemoryheapisdisabled
2013-11-2613:41:556793[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins
2013-11-2613:41:556793[Note]InnoDB:Compressedtablesusezlib1.2.3
2013-11-2613:41:556793[Note]InnoDB:NotusingCPUcrc32instructions
2013-11-2613:41:556793[Note]InnoDB:Initializingbufferpool,size=128.0M
2013-11-2613:41:556793[Note]InnoDB:Completedinitializationofbufferpool
2013-11-2613:41:556793[Note]InnoDB:HighestsupportedfileformatisBarracuda.
2013-11-2613:41:556793[Note]InnoDB:128rollbacksegment(s)areactive.
2013-11-2613:41:556793[Note]InnoDB:Waitingforpurgetostart
2013-11-2613:41:556793[Note]InnoDB:5.6.14started;logsequencenumber1625997
2013-11-2613:41:556793[Note]Binlogend
2013-11-2613:41:556793[Note]InnoDB:FTSoptimizethreadexiting.
2013-11-2613:41:556793[Note]InnoDB:Startingshutdown...
2013-11-2613:41:576793[Note]InnoDB:Shutdowncompleted;logsequencenumber1626007
OK
Tostartmysqldatboottimeyouhavetocopy
support-files/mysql.servertotherightplaceforyoursystem
PLEASEREMEMBERTOSETAPASSWORDFORTHEMySQLrootUSER!
Todoso,starttheserver,thenissuethefollowingcommands:
/usr/local/mysql/bin/mysqladmin-urootpasswordnew-password
/usr/local/mysql/bin/mysqladmin-uroot-hpacteralinuxpasswordnew-password
Alternativelyyoucanrun:
/usr/local/mysql/bin/mysql_secure_installation
whichwillalsogiveyoutheoptionofremovingthetest
databasesandanonymoususercreatedbydefault.Thisis
stronglyrecommendedforproductionservers.
Seethemanualformoreinstructions.
YoucanstarttheMySQLdaemonwith:
cd.;/usr/local/mysql/bin/mysqld_safe&
YoucantesttheMySQLdaemonwithmysql-test-run.pl
cdmysql-test;perlmysql-test-run.pl
Pleasereportanyproblemswiththe./bin/mysqlbugscript!
ThelatestinformationaboutMySQLisavailableonthewebat
http://www.mysql.com
SupportMySQLbybuyingsupport/licensesathttp://shop.mysql.com
WARNING:Foundexistingconfigfile/usr/local/mysql/my.cnfonthesystem.
Becausethisfilemightbeinuse,itwasnotreplaced,
butwasusedinbootstrap(unlessyouused--defaults-file)
andwhenyoulaterstarttheserver.
Thenewdefaultconfigfilewascreatedas/usr/local/mysql/my-new.cnf,
pleasecompareitwithyourfileandtakethechangesyouneed.
WARNING:Defaultconfigfile/etc/my.cnfexistsonthesystem
ThisfilewillbereadbydefaultbytheMySQLserver
Ifyoudonotwanttousethis,eitherremoveit,orusethe
--defaults-fileargumenttomysqld_safewhenstartingtheserver
从头启动mysql
1
2
3
4
5
6
7
8
[root@pacteralinuxscripts]#servicemysqldstart
StartingMySQL.[OK]
[root@pacteralinuxmysql]#ps-ef|grepmsyql
root72364316014:08pts/100:00:00grepmsyql
[root@pacteralinuxmysql]#ps-ef|grepmysql
root68381013:42pts/100:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/mnt/resource/mysqldate--pid-file=/mnt/resource/mysqldate/pacteralinux.pid
mysql70916838013:42pts/100:00:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/mnt/resource/mysqldate--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=/mnt/resource/mysqldate/pacteralinux.err--pid-file=/mnt/resource/mysqldate/pacteralinux.pid--socket=/mnt/resource/mysqldate/mysql.sock--port=3306
root72384316014:08pts/100:00:00grepmysql
能够看到,mysql装置路径为--basedir=/usr/local/mysql,初始数据库的寄存目次为--datadir=/mnt/resource/mysqldate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-rw-rw----.1mysqlmysql2048Nov2613:41user.MYI
[root@pacteralinuxmysql]#pwd
/mnt/resource/mysqldate/mysql
[root@pacteralinuxmysql]#cd..
[root@pacteralinuxmysqldate]#ll
total110664
-rw-rw----.1mysqlmysql56Nov2517:17auto.cnf
-rw-rw----.1mysqlmysql12582912Nov2613:42ibdata1
-rw-rw----.1mysqlmysql50331648Nov2613:42ib_logfile0
-rw-rw----.1mysqlmysql50331648Nov2613:39ib_logfile1
drwx------.2mysqlmysql4096Nov2613:41mysql
srwxrwxrwx.1mysqlmysql0Nov2613:42mysql.sock
-rw-rw----.1mysqlroot46096Nov2613:42pacteralinux.err
-rw-rw----.1mysqlmysql5Nov2613:42pacteralinux.pid
drwx------.2mysqlmysql4096Nov2613:41performance_schema
drwx------.2mysqlmysql4096Nov2613:41test
个中,mysql,performance_schema,test为初始化后的文件
上面入手下手规复数据库
登录到临盆办事器实行备份:
1
[root@uyhd000225~]#mysqldump-u*****-p*****mysqldb>mysqldb20131126.sql#数据库对照年夜,约莫半小时
复制到备份办事器:
1
2
3
[root@uyhd000225~]#scpmysqldb20131126.sqlroot@remoteIP:/mnt/backup/
root@remoteIPspassword:
mysqldb20131126.sql3%153MB680.6KB/s1:43:33ETA
作者:
莫相离
时间:
2015-1-16 18:06
标题:
带来一篇Linux下mysql数据库文件全体丧失mysql没法启动
熟读Linux系统有关知识,如系统目录树,有关内容可购书阅读或搜索论坛。
作者:
金色的骷髅
时间:
2015-1-25 22:29
写学习日记,这是学习历程的见证,同时我坚持认为是增强学习信念的法宝。
作者:
若天明
时间:
2015-2-4 15:56
熟读写基础知识,学得会不如学得牢。
作者:
爱飞
时间:
2015-2-10 04:21
尽量不要提问纯属是扯蛋.学习Linux特别是自己一个人初学入手的时候没人教很困难.当然如果可以的话平时多去买些Linux书...对学习Linux很有帮助.
作者:
只想知道
时间:
2015-2-28 21:40
Windows?是图形界面的,Linux类似以前的?DOS,是文本界面的,如果你运行了图形界面程序X-WINDOWS后,Linux?也能显示图形界面,也有开始菜单、桌面、图标等。
作者:
乐观
时间:
2015-3-10 13:01
熟读写基础知识,学得会不如学得牢。
作者:
再现理想
时间:
2015-3-17 12:09
不同于Windows?系统需要花钱购买,因为Linux的核心是免费的,自由使用的,核心源代码是开放的。
作者:
仓酷云
时间:
2015-3-24 13:42
写学习日记,这是学习历程的见证,同时我坚持认为是增强学习信念的法宝。
欢迎光临 仓酷云 (http://ckuyun.com/)
Powered by Discuz! X3.2