From 0852a8908fa8ea15afa0402c11debf19fa8f1924 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 4 May 2018 21:33:22 -0700 Subject: [PATCH] Fix handling of missing my.cnf file when using remote mysql https://sourceforge.net/p/webadmin/bugs/4578/ --- mysql/index.cgi | 10 ++++++++++ mysql/lang/en | 1 + 2 files changed, 11 insertions(+) diff --git a/mysql/index.cgi b/mysql/index.cgi index 6a9c64902..82372057c 100755 --- a/mysql/index.cgi +++ b/mysql/index.cgi @@ -66,6 +66,16 @@ if ($r > 0 && !&working_env_pass()) { exit; } +# Check if my.cnf was found +if (&is_mysql_local() && $config{'my_cnf'} && !-r $config{'my_cnf'}) { + &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1, 0, + &help_search_link("mysql", "man", "doc", "google")); + print &text('index_ecnf', "$config{'my_cnf'}", + "../config.cgi?$module_name"),"

\n"; + &ui_print_footer("/", $text{'index'}); + exit; + } + if ($r == 0) { # Not running .. need to start it &main_header(); diff --git a/mysql/lang/en b/mysql/lang/en index 791108f2d..ffb0e987f 100644 --- a/mysql/lang/en +++ b/mysql/lang/en @@ -28,6 +28,7 @@ index_nomod=Warning: The Perl module $1 is not installed on your system, so Webm index_nomods=Warning: The Perl modules $1 and $2 are not installed on your system, so Webmin will not be able to reliably access your MySQL database. Click here to install them now. index_mysqlver=The command $1 returned : index_eenvpass=The MySQL client program $1 does not accept passwords passed using the MYSQL_PWD environment variable. To ensure that Webmin is able to fully communicate with MySQL, this option should be turned off on the module configuration page. Alternately, you can remove any password set in the root user's .my.cnf file. +index_ecnf=The MySQL config file $1 was not found on your system. Use the module configuration page to set the correct path. index_nodbs=You do not have access to any MySQL databases. index_nodbs2=No MySQL databases were found on your system. index_nodbs3=No MySQL databases matched your search.