add_mode=Use vertical row editing interface,1,1-Yes,0-No
blob_mode=Show blob and text fields as,1,0-Data in table,1-Links to download
nodbi=Use DBI to connect if available?,1,0-Yes,1-No
+nopwd=Use MYSQL_PWD variable to pass password?,1,0-Yes,1-No
date_subs=Do <tt>strftime</tt> substitution of backup destinations?,1,1-Yes,0-No
passwd_mode=Password hashing mode,1,1-Old,0-Default
encoding=Encoding for database content,3,Default (from current language)
&ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1, 0,
&help_search_link("mysql", "man", "doc", "google"));
print &text('index_elibrary', "<tt>$config{'mysql'}</tt>",
- "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
+ "../config.cgi?$module_name"),"<p>\n";
print &text('index_mysqlver', "$config{'mysql'} -V"),"\n";
print "<pre>$out</pre>\n";
&ui_print_footer("/", $text{'index'});
&ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1, 0,
&help_search_link("mysql", "man", "doc", "google"));
print &text('index_ever', "<tt>$config{'mysql'}</tt>",
- "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
+ "../config.cgi?$module_name"),"<p>\n";
print &text('index_mysqlver', "$config{'mysql'} -V"),"\n";
print "<pre>$out</pre>\n";
&ui_print_footer("/", $text{'index'});
print VERSION $mysql_version,"\n";
close(VERSION);
+# Check if MYSQL_PWD works
($r, $rout) = &is_mysql_running();
+if ($r > 0 && !&working_env_pass()) {
+ &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1, 0,
+ &help_search_link("mysql", "man", "doc", "google"));
+ print &text('index_eenvpass', "<tt>$config{'mysql'}</tt>",
+ "../config.cgi?$module_name"),"<p>\n";
+ &ui_print_footer("/", $text{'index'});
+ exit;
+ }
+
if ($r == 0) {
# Not running .. need to start it
&main_header();
print "</form>\n";
}
}
-elsif ($r == -1 && $access{'user'} && 0) {
- # Running, but the user's password is wrong
- &main_header();
- print "<b>",&text('index_nouser', "<tt>$access{'user'}</tt>"),
- "</b><p>\n";
- print &text('index_emsg', "<tt>$rout</tt>"),"<p>\n";
- }
elsif ($r == -1) {
# Running, but webmin doesn't know the root (or user's) password!
&main_header();
index_nomod=Warning: The Perl module $1 is not installed on your system, so Webmin will not be able to reliably access your MySQL database. <a href='$2'>Click here</a> to install it now.
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. <a href='$3'>Click here</a> to install them now.
index_mysqlver=The command <tt>$1</tt> returned :
+index_eenvpass=The MySQL client program $1 does not accept passwords passed using the <tt>MYSQL_PWD</tt> environment variable. To ensure that Webmin is able to fully communicate with MySQL, this option should be turned off on the <a href='$2'>module configuration</a> page.
index_nodbs=You do not have access to any MySQL databases.
index_nodbs2=No MySQL databases were found on your system.
index_backup=Backup Databases
sub is_mysql_running
{
# First type regular connection
-if ($driver_handle) {
+if ($driver_handle && !$config{'nodbi'}) {
local $main::error_must_die = 1;
local ($data, $rv);
eval { $data = &execute_sql_safe(undef, "select version()") };
&webmin_debug_log('SQL', "db=$_[0] sql=$sql".$params);
}
$sql =~ s/\\/\\\\/g;
-if ($driver_handle) {
+if ($driver_handle && !$config{'nodbi'}) {
# Use the DBI interface
local $cstr = "database=$_[0]";
$cstr .= ";host=$config{'host'}" if ($config{'host'});
# Returns 1 if passing the password via an environment variable is supported
sub supports_env_pass
{
-return $mysql_version >= 4.1;
+return $mysql_version >= 4.1 && !$config{'nopwd'};
+}
+
+# working_env_pass()
+# Returns 1 if MYSQL_PWD can be used to pass the password to mysql
+sub working_env_pass
+{
+return 1 if (!&supports_env_pass()); # Not even used
+local $config{'nodbi'} = 1;
+local $data;
+local $main::error_must_die = 1;
+eval { $data = &execute_sql_safe(undef, "select version()") };
+return $@ || !$data ? 0 : 1;
}
# user_priv_cols()