[转载]vps下mysql备份、恢复(特别针对lnmp一键安装包环境)

一般小型网站的mysql数据库都是用phpmyadmin备份还原数据库

但是论坛数据有时候变大了,phpmyadmin不是那么给力,譬如说300M的数据库,再用phpmyadmin那就有点那个啥了

直接用SSH登陆备份是最省事的

这里都是针对lnmp一键安装包的默认环境,如果是其他环境,只需要改变下目录名称就可以了

备份数据

/usr/local/mysql/bin/mysqldump -u root -pmima ultrax > /home/wwwroot/my.sql (mysqldump最好使用绝对路径)

其中:root为数据库用户名
mima为对应root数据库密码,密码和-P之间不要有空格
ultrax(是discuz默认新建的)是需要导出的数据库名。
/home/backup/discuz.sql是数据库文件sql导出的路径。

恢复数据

/usr/local/mysql/bin/mysql -u root -pmima xxx< /home/backup/discu.sql

还有一个最直接的办法,那就是直接备份打包/usr/local/mysql/var/ultrax这个目录,xxx是数据库名,还原的时候解压到这个目录,最后在更改文件夹所述用户为mysql,赋权限,命令如下:

#chown -R mysql:mysql xxx(数据库文件夹)

#chmod 660 xxx/*

分享到:

36 条评论

昵称
  1. Brenna

    I’m gone to say to my little brother, that he should also visit this web
    site on regular basis too obtain updated frlm
    most up-to-date reports.

  2. Jody

    Thanks for ones marvelous posting! I genuinely enjoyed reading it, you are
    a great author.I will make sure to bookmark yor blog and maay come back at some point.
    I want to encourage one to continue your great writing, havee a nice afternoon!

  3. Cedric

    I rewally love your site.. Great colors & theme. Did
    you build this web site yourself? Please reply back as I’mwanting to
    create my own blog and want to learn where you got this from oor
    exactly what the theme is named. Cheers!

  4. Felicia

    Link exchange is nothing else except iit is simply placing the other person’s website link on your page
    at suijtable place and other person will also do same iin favor of
    you.

  5. Milford

    We’re a group of volunteers and opening a new scheme in our community.
    Your site offered us with valuable informatipn to work on. You have done an impressive joob and our whople community will be thankful to you.

  6. www.youtube.com

    I think the admikn of this web site is really working hardd in favor
    oof his site, because here every material is quality based information.

  7. Academia.Edu

    Everyone loves what you guyts are usually up too. Such clever work and exposure!
    Keepp up the fantastic works guys I’ve included you guys too blogroll.

  8. Amee

    You could certainly see your expertise within the article
    yyou write. The world hopes for more passionate writers
    like you who are not afraid to say how they believe.

    At aall times follow your heart.

  9. Lane

    Hello, Neat post. There is a problem along with your site
    in web explorer, may test this? IE nonetheless
    is the marketplace chieef and a huge portion of folks will omit your
    magnificent writing duue to this problem.

  10. Marc

    Hello there! Do you know if they ake any plugins to protect against
    hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any suggestions?

  11. milf

    What’s up to every , since I am genuinely keen of reading
    this web site’s pos too be updated regularly. It includes fastidious material.

  12. porn

    I visited various blogs but the audio feature for audio songs existing at this web
    site is actually superb.

  13. pirater un compte facebook

    My ckder is trying to persduade me to move to .net from PHP.
    I have always disliked the idea because of the expenses.
    But he’stryiong none the less. I’ve been using Movable-type on numerous websites
    for about a yearr and am concerned about switching to another platform.
    I have heard great things aboutt blogengine.net. Is there
    a way I can transer all my wordpress content into it? Any help
    would be realloy appreciated!

  14. wholesale bath bombs

    Great blog here! Also your web sitre loads
    upp fast! What web host are you using? Cann I get your affiliate link to your host?

    I wish my web site loaded upp as quickly as yours lol

  15. China Cheap

    Simply wish to say your article is as astounding.
    The clarity in your post is simply great and i can assume you’re an expert
    on this subject. Well withh your permission allow mme to grab your RSS
    feed to keep up to date with forthcoming post.

    Thanks a million and please continue the enjoyable work.

  16. Marvelous, what a webpage it is! This website gives useful data to us, keep it up.

  17. buy cbd oil for pain

    What i don’t understood is in reality how you’re now not
    really a lot more smartly-preferred than you mmay be right now.
    You are very intelligent. You know therefore significantly when it comes to this subject, made me in my opinion consider it from so many numerous angles.
    Its like women and men aren’t involved until it is something tto accomplish with Woman gaga!

    Your individual stuffs outstanding. At all times maintain it up!

  18. cbd oil for sale

    I absolutely love your blog and find a lot of ypur post’s to be exactly what
    I’m looking for. Does one offer guest writers to write content for you?
    I wouldn’t mind creating a post or elaborating on many of thee subjects
    yyou write related tto here. Again, awesome weblog!

  19. buy hemp oil cbd

    When I originally commented I clicked the “Notify me when new comments are added” checkox
    aand now each time a comment is added I get four e-mails with
    the same comment. Is there any way you can remve me from that service?
    Thank you!

  20. buy cannabis oil online

    I believe this is among the so much vital information for me.
    And i’m satisfied studying your article.

    But wan to statement on some common issues, The
    website style is wonderful, the articcles is actually great :
    D. Good task, cheers

  21. Thiss website was… how do I say it? Relevant!!
    Finally I have founbd something which helped me.
    Cheers!

  22. maltepe escort

    What’s Happening i’m new to this, I stumbled upon this I have flund It positfively useful and it has helped me out loads.I’m hping
    too contribute & aidd different customers like its aided me.

    Great job.

  23. anadolu yakasi escort

    I think the admin of this website is genuinely working hard for his web page,
    since hesre every stff is quality based stuff.

  24. istanbul escort

    oof coursxe like your websaite however you have to check the spelling on several of your posts.
    A number of them are rife with spelling prolems and I tto find it
    very troublesome to telkl the truth however I will definitely come again again.

  25. umraniye escort

    Thanks inn support off shariing such a good idea, ost
    is good, thats why i have read it completely

  26. maltepe escort

    Incredible qquest there. What occurrded after? Take care!

  27. boston car service

    Hi everyone, it’s my first pay a quick vosit
    at this web page, and post is truly fruitful in favor of me, keep up posting these types of articles or reviews.

  28. Howdy! I just wish to give you a big thumbs upp for the great info you have got here
    on tbis post. I’ll bbe coming back too your sitge for
    ore soon.

  29. http://www.14pd.com/

    冒险岛sf一条龙_惊天动地sf一条龙_热血江湖sf一条龙_问道sf一条龙_密传sf一条龙天龙sf一条龙开服07cg.comQQ1325876192

  30. 端游私服一条龙

    乱舞三国ol4.0www.39uc.cn