• java 导出mysql


    java导出mysql备份
    public String BackDBNow(HttpServletRequest request, String path, String username, String password) throws IOException {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String filename=System.currentTimeMillis()+".sql";
            if (username.equals("root") && password.equals("")) {
                File file = new File(path);
                boolean directory = file.isDirectory();
                boolean exists = file.exists();
                if (!directory || !exists) {
                    request.setAttribute("message", "请输入正确的路径");
                } else {
                    String sql = "cmd /c D:/mysql/mysql-5.5.46-winx64/bin/mysqldump   -h192.168.88.11 -u" + username + " -pPassw0rd! test > " + path + "/"+filename;
                    Runtime.getRuntime().exec(sql);
                }
                request.setAttribute("message", "操作完成");
                return "redirect:BackDB?username=" + username + "&password=" + password + "&path=" + path;
            } else {
                request.setAttribute("message", "用户名密码错误");
            }
            return "redirect:BackDB?username=" + username + "&password=" + password + "&path=" + path;
        }
  • 相关阅读:
    python主成分分析
    matplotlib绘图pie
    cpu监控:mpstat命令
    cpu监控:dstat
    MongoDB--安装部署
    Linux-网络管理
    Apache 虚拟主机配置
    Apache 访问控制
    Apache 域名跳转配置
    Apache 日志管理
  • 原文地址:https://www.cnblogs.com/songfahzun/p/8403967.html
Copyright © 2020-2023  润新知