linux下使用crontab定时备份MYSQL数据库的方法只需按照下面3步做,一切都在你的掌控之下:
会遇到的问题:1.mysqldump 是备份数据库的命令,不懂直接百度就好。2.Crontab 是定时任务的命令,如果不懂可以访问http://www.thinkphp.cn/code/1003.html3.备份数据首先要确定已经给root设置了密码,否则会报mysqldump执行时Got error: 1045: Access denied for user ‘root’@’localhost’ (using password: YES) when trying to connect解决办法:登录mysql客户端
1 mysql -hserverip -uroot -p 2 mysql> use mysql; Database changed 3 mysql> update user set password=password('new password') where user='root'; Query OK, 4 rows affected (0.00 sec) Rows matched: 4 Changed: 4 Warnings: 0 4 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) //这个命令是给用户赋予了新的权限或者密码,直接读到内存中不需要重启数据库防止出错 5 mysql> quit
转载于:https://www.cnblogs.com/CHEUNGKAMING/p/5717455.html
相关资源:JAVA上百实例源码以及开源项目