29dac6bccdd0a78a0805e5a4209379f65484c3d0 max Tue Oct 1 03:24:58 2024 -0700 improving sql profile error message a little, email from Jim diff --git src/hg/lib/sqlProg.c src/hg/lib/sqlProg.c index fb5644b..13d146c 100644 --- src/hg/lib/sqlProg.c +++ src/hg/lib/sqlProg.c @@ -123,31 +123,32 @@ // SYSCONFDIR/my.cnf should be next, but I do not think it matters. maybe it is just /var/lib/mysql anyways. safef(path, sizeof path, "%s/my.cnf", getenv("MYSQL_HOME")); copyCnfToDefaultsFile(path, defaultFileName, fileNo); safef(path, sizeof path, "%s/.my.cnf", getenv("HOME")); copyCnfToDefaultsFile(path, defaultFileName, fileNo); /* write out the group name, user, host, and password */ safef(paddedGroup, sizeof(paddedGroup), "[%s]\n", group); if (write (fileNo, paddedGroup, strlen(paddedGroup)) == -1) errAbort("Writing group to temporary file %s failed with errno %d", defaultFileName, errno); char *settings = sqlProfileToMyCnf(profile); if (!settings) - errAbort("profile '%s.*' not found in sqlProfileToMyCnf() -- failed for file '%s' failed with errno %d", profile, defaultFileName, errno); + errAbort("Could not connect to MySQL. Profile '%s.*' not found in sqlProfileToMyCnf() -- failed for file '%s' with errno %d. " + "Most likely the statements db.host, db.user and db.password as missing in ~/.hg.conf.", profile, defaultFileName, errno); if (sameString(prog, "mysqldump")) { // need to suppress the database setting, it messes up mysqldump and is not needed. comment it out settings = replaceChars(settings, "\ndatabase=", "\n#database="); } if (write (fileNo, settings, strlen(settings)) == -1) errAbort("Writing profile '%s' settings=[%s] as my.cnf format failed for file '%s' failed with errno %d", profile, settings, defaultFileName, errno); return fileNo; } void sqlExecProg(char *prog, char **progArgs, int userArgc, char *userArgv[]) /* Exec one of the sql programs using user and password from ~/.hg.conf. * progArgs is NULL-terminate array of program-specific arguments to add,