带来一篇Linux下mysql数据库文件全体丧失mysql没法启动
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们!一夙兴来,发明数据目次下的mysql文件全体消散,一声盗汗,怎样回事!!???被黑了,仍是由于前两天重启办事器招致mysql数据丧失???这是怎样回事,上彀看看怎样办理,没找到办理计划!!!!看看mysql办事是否是开启的,#ps-ef|grepmysqlroot53794291013:10pts/000:00:00grepmysql#servicemysqldstartStartingMySQL..TheserverquitwithoutupdatingPIDfile(/mnt/resource/mysqldate/pacteralinux.pid).,办事封闭,并且启动不了!看日记:
13112613:10:57mysqld_safeStartingmysqlddaemonwithdatabasesfrom/mnt/resource/mysqldate2013-11-2613:10:580TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).2013-11-2613:10:585650PluginFEDERATEDisdisabled./usr/local/mysql/bin/mysqld:Tablemysql.plugindoesntexist2013-11-2613:10:585650Cantopenthemysql.plugintable.Pleaserunmysql_upgradetocreateit.2013-11-2613:10:585650InnoDB:TheInnoDBmemoryheapisdisabled2013-11-2613:10:585650InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins2013-11-2613:10:585650InnoDB:Compressedtablesusezlib1.2.32013-11-2613:10:585650InnoDB:NotusingCPUcrc32instructions2013-11-2613:10:585650InnoDB:Initializingbufferpool,size=128.0M2013-11-2613:10:585650InnoDB:Completedinitializationofbufferpool2013-11-2613:10:585650InnoDB:Thefirstspecifieddatafile./ibdata1didnotexist:anewdatabasetobecreated!2013-11-2613:10:585650InnoDB:Settingfile./ibdata1sizeto12MB2013-11-2613:10:585650InnoDB:Databasephysicallywritesthefilefull:wait...2013-11-2613:10:585650InnoDB:Settinglogfile./ib_logfile101sizeto48MB2013-11-2613:10:585650InnoDB:Settinglogfile./ib_logfile1sizeto48MB2013-11-2613:10:585650InnoDB:Renaminglogfile./ib_logfile101to./ib_logfile02013-11-2613:10:585650InnoDB:Newlogfilescreated,LSN=457812013-11-2613:10:585650InnoDB:Doublewritebuffernotfound:creatingnew2013-11-2613:10:585650InnoDB:Doublewritebuffercreated2013-11-2613:10:585650InnoDB:128rollbacksegment(s)areactive.2013-11-2613:10:595650InnoDB:Creatingforeignkeyconstraintsystemtables.2013-11-2613:10:595650InnoDB:Foreignkeyconstraintsystemtablescreated2013-11-2613:10:595650InnoDB:Creatingtablespaceanddatafilesystemtables.2013-11-2613:10:595650InnoDB:Tablespaceanddatafilesystemtablescreated.2013-11-2613:10:595650InnoDB:Waitingforpurgetostart2013-11-2613:10:595650InnoDB:5.6.14started;logsequencenumber02013-11-2613:10:595650Serverhostname(bind-address):*;port:33062013-11-2613:10:595650IPv6isavailable.2013-11-2613:10:595650-::resolvesto::;2013-11-2613:10:595650ServersocketcreatedonIP:::.2013-11-2613:10:595650Fatalerror:Cantopenandlockprivilegetables:Tablemysql.userdoesntexist13112613:10:59mysqld_safemysqldfrompidfile/mnt/resource/mysqldate/pacteralinux.pidendedFatalerror:Cantopenandlockprivilegetables:Tablemysql.userdoesntexist:表初始化没做好;不论,下认识的删除日记看下能不克不及重启
1
2
3
4
5
6
7
8
9
10
11
#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
#rmib*
rm:removeregularfile`ibdata1?y
rm:removeregularfile`ib_logfile0?y
rm:removeregularfile`ib_logfile1?y
不可,网上看看能不克不及规复数据,无办理计划!!
幸亏这时候一个mysql从办事器(我做了一个主从mysql热备份)!!!没举措,数据规复不了就从头在复制一份吧!
上述步调后仍是不克不及启动数据
尝尝从头初始化:
#/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.#cd/usr/local/mysql/bin/#/usr/local/mysql/scripts/mysql_install_db--user=mysql--no-defaultsInstallingMySQLsystemtables...2013-11-2613:20:420TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).2013-11-2613:20:426036InnoDB:TheInnoDBmemoryheapisdisabled2013-11-2613:20:426036InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins2013-11-2613:20:426036InnoDB:Compressedtablesusezlib1.2.32013-11-2613:20:426036InnoDB:NotusingCPUcrc32instructions2013-11-2613:20:426036InnoDB:Initializingbufferpool,size=128.0M2013-11-2613:20:426036InnoDB:Completedinitializationofbufferpool2013-11-2613:20:426036InnoDB:HighestsupportedfileformatisBarracuda.2013-11-2613:20:426036InnoDB:128rollbacksegment(s)areactive.2013-11-2613:20:426036InnoDB:Waitingforpurgetostart2013-11-2613:20:426036InnoDB:5.6.14started;logsequencenumber16006072013-11-2613:20:426036InnoDB: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:426036Aborting2013-11-2613:20:426036Binlogend2013-11-2613:20:426036InnoDB:FTSoptimizethreadexiting.2013-11-2613:20:426036InnoDB:Startingshutdown...2013-11-2613:20:446036InnoDB:Shutdowncompleted;logsequencenumber16006172013-11-2613:20:446036./bin/mysqld:Shutdowncomplete初始化不了,,删除之前初始化的文件尝尝
1
2
3
4
5
6
7
#ll
total12
drwx------.2mysqlmysql4096Sep2512:27mysql
drwx------.2mysqlmysql4096Sep2512:27performance_schema
drwxr-xr-x.2mysqlmysql4096Sep2510:28test
#cd..
#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
#scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/mnt/resource/mysqldate--user=mysql
InstallingMySQLsystemtables...2013-11-2613:41:480TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).
2013-11-2613:41:486768InnoDB:TheInnoDBmemoryheapisdisabled
2013-11-2613:41:486768InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins
2013-11-2613:41:486768InnoDB:Compressedtablesusezlib1.2.3
2013-11-2613:41:486768InnoDB:NotusingCPUcrc32instructions
2013-11-2613:41:486768InnoDB:Initializingbufferpool,size=128.0M
2013-11-2613:41:486768InnoDB:Completedinitializationofbufferpool
2013-11-2613:41:486768InnoDB:HighestsupportedfileformatisBarracuda.
2013-11-2613:41:486768InnoDB:Logscanprogressedpastthecheckpointlsn49463
2013-11-2613:41:486768InnoDB:Databasewasnotshutdownnormally!
2013-11-2613:41:486768InnoDB:Startingcrashrecovery.
2013-11-2613:41:486768InnoDB:Readingtablespaceinformationfromthe.ibdfiles...
2013-11-2613:41:486768InnoDB:Restoringpossiblehalf-writtendatapages
2013-11-2613:41:486768InnoDB:fromthedoublewritebuffer...
InnoDB:Doingrecovery:scanneduptologsequencenumber1600617
2013-11-2613:41:486768InnoDB:Startinganapplybatchoflogrecordstothedatabase...
InnoDB:Progressinpercent:282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
InnoDB:Applybatchcompleted
2013-11-2613:41:486768InnoDB:128rollbacksegment(s)areactive.
2013-11-2613:41:486768InnoDB:Waitingforpurgetostart
2013-11-2613:41:486768InnoDB:5.6.14started;logsequencenumber1600617
2013-11-2613:41:546768Binlogend
2013-11-2613:41:546768InnoDB:FTSoptimizethreadexiting.
2013-11-2613:41:546768InnoDB:Startingshutdown...
2013-11-2613:41:556768InnoDB:Shutdowncompleted;logsequencenumber1625997
OK
Fillinghelptables...2013-11-2613:41:550TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).
2013-11-2613:41:556793InnoDB:TheInnoDBmemoryheapisdisabled
2013-11-2613:41:556793InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins
2013-11-2613:41:556793InnoDB:Compressedtablesusezlib1.2.3
2013-11-2613:41:556793InnoDB:NotusingCPUcrc32instructions
2013-11-2613:41:556793InnoDB:Initializingbufferpool,size=128.0M
2013-11-2613:41:556793InnoDB:Completedinitializationofbufferpool
2013-11-2613:41:556793InnoDB:HighestsupportedfileformatisBarracuda.
2013-11-2613:41:556793InnoDB:128rollbacksegment(s)areactive.
2013-11-2613:41:556793InnoDB:Waitingforpurgetostart
2013-11-2613:41:556793InnoDB:5.6.14started;logsequencenumber1625997
2013-11-2613:41:556793Binlogend
2013-11-2613:41:556793InnoDB:FTSoptimizethreadexiting.
2013-11-2613:41:556793InnoDB:Startingshutdown...
2013-11-2613:41:576793InnoDB: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
#servicemysqldstart
StartingMySQL.
#ps-ef|grepmsyql
root72364316014:08pts/100:00:00grepmsyql
#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
#pwd
/mnt/resource/mysqldate/mysql
#cd..
#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
#mysqldump-u*****-p*****mysqldb>mysqldb20131126.sql#数据库对照年夜,约莫半小时
复制到备份办事器:
1
2
3
#scpmysqldb20131126.sqlroot@remoteIP:/mnt/backup/
root@remoteIPspassword:
mysqldb20131126.sql3%153MB680.6KB/s1:43:33ETA
带来一篇Linux下mysql数据库文件全体丧失mysql没法启动
熟读Linux系统有关知识,如系统目录树,有关内容可购书阅读或搜索论坛。 写学习日记,这是学习历程的见证,同时我坚持认为是增强学习信念的法宝。 熟读写基础知识,学得会不如学得牢。 尽量不要提问纯属是扯蛋.学习Linux特别是自己一个人初学入手的时候没人教很困难.当然如果可以的话平时多去买些Linux书...对学习Linux很有帮助. Windows?是图形界面的,Linux类似以前的?DOS,是文本界面的,如果你运行了图形界面程序X-WINDOWS后,Linux?也能显示图形界面,也有开始菜单、桌面、图标等。 熟读写基础知识,学得会不如学得牢。 不同于Windows?系统需要花钱购买,因为Linux的核心是免费的,自由使用的,核心源代码是开放的。 写学习日记,这是学习历程的见证,同时我坚持认为是增强学习信念的法宝。
页:
[1]