This commit is contained in:
Jamie Cameron
2024-11-07 21:31:47 -08:00
parent d826b3423f
commit e2bc898b57
4 changed files with 22 additions and 0 deletions

View File

@ -300,6 +300,9 @@ else {
# Show stop button
if ($access{'stop'} && &is_mysql_local()) {
print &ui_buttons_row("restart.cgi", $text{'index_restart'},
$text{'index_restartmsg'});
print &ui_buttons_row("stop.cgi", $text{'index_stop'},
$text{'index_stopmsg'});
}

View File

@ -9,6 +9,8 @@ index_pass=Password
index_clear=Clear
index_stop=Stop MySQL Server
index_stopmsg=Click this button to stop the MySQL database server on your system. This will prevent any users or programs from accessing the database, including this Webmin module.
index_restart=Resart MySQL Server
index_restartmsg=Click this button to restart the MySQL database server on your system. All clients will be disconnected, and any configuration files will be reloaded.
index_dbs=MySQL Databases
index_add=Create a new database.
index_global=Global Options
@ -540,6 +542,7 @@ acl_views=Can view and manage views?
acl_files=Can execute SQL from local files?
log_start=Started MySQL server
log_restart=Restarted MySQL server
log_stop=Stopped MySQL server
log_cnf=Changed MySQL server configuration
log_ssl=Changed SSL certificate

View File

@ -14,6 +14,9 @@ if ($action eq 'stop') {
elsif ($action eq 'start') {
return $text{'log_start'};
}
elsif ($action eq 'restart') {
return $text{'log_restart'};
}
elsif ($action eq 'cnf') {
return $text{'log_cnf'};
}

13
mysql/restart.cgi Executable file
View File

@ -0,0 +1,13 @@
#!/usr/local/bin/perl
# Restart the MySQL database server
require './mysql-lib.pl';
&error_setup($text{'restart_err'});
$err = &stop_mysql();
&error($err) if ($err);
$err = &start_mysql();
&error($err) if ($err);
sleep(3);
&webmin_log("restart");
&redirect("");