沐可の博客 沐可の博客

Linux下mysql数据库备份与还原

in 技术教程 read (67) 文章转载请注明来源!
  • 备份数据库

    找到mysql安装位置,例如我安装的mysql在 /usr/local/mysql 目录下

    进入mysql目录,cd /usr/local/mysql

    数据库,mysqldump -u root -p typecho > typecho.sql

    typecho为需要备份的数据库,typecho.sql为备份后数据库名称

    敲完命令后,会提示输入数据库密码,输入密码,回车(密码不会显示)

    操作完成后会在mysql安装目录下生成一个备份文件,后缀为sql,然后可将其下载到本地。

  • 还原数据库

    进入mysql目录,cd /usr/local/mysql

    还原数据库,mysql -u root -p typecho < typecho.sql

  • 注意:MySQL版本最好保持一致,否则可能出现一系列问题。
备份还原数据库
最后由沐可修改于2017-07-02 18:00
已有 5 条评论
  1. Kam Ki Bate

    Hey there! Do you know if they make any plugins to safeguard
    against hackers? I'm kinda paranoid about losing everything I've worked hard on. Any
    recommendations?

  2. www.theunbiasedblog.com

    I have been surfing online more than 3 hours today, but I
    by no means discovered any interesting article like yours.

    It is lovely price enough for me. Personally, if all web owners and bloggers made excellent content
    material as you did, the web might be much more helpful than ever before.

  3. Ethan
    Ethan
    回复

    Hello i am kavin, its my first occasion to commenting
    anyplace, when i read this article i thought i could also
    create comment due to this brilliant piece of writing.

  4. www.techmasai.com

    Hi there to every body, it's my first go to see of this
    blog; this weblog contains remarkable and actually excellent stuff in support of readers.

  5. best time quotes

    I've read some good stuff here. Definitely price bookmarking for revisiting.
    I wonder how much attempt you place to make such a magnificent informative web site.

发表新评论
博客已萌萌哒运行
© 2017 由 Typecho 强力驱动.Theme by Yodu
前篇 后篇
雷姆
拉姆