feat: Mysql 数据库增删、改密、改权限方法封装

This commit is contained in:
ssongliu
2023-07-19 16:25:41 +08:00
committed by ssongliu
parent 34e8d88a53
commit bd5dc56b66
15 changed files with 878 additions and 4 deletions

View File

@@ -585,7 +585,7 @@ func excSQL(containerName, password, command string) error {
cmd := exec.CommandContext(ctx, "docker", "exec", containerName, "mysql", "-uroot", "-p"+password, "-e", command)
stdout, err := cmd.CombinedOutput()
if ctx.Err() == context.DeadlineExceeded {
return buserr.WithDetail(constant.ErrExecTimeOut, containerName, nil)
return buserr.New(constant.ErrExecTimeOut)
}
stdStr := strings.ReplaceAll(string(stdout), "mysql: [Warning] Using a password on the command line interface can be insecure.\n", "")
if err != nil || strings.HasPrefix(string(stdStr), "ERROR ") {