Forum Moderators: coopster
This is what I have done so far to restart the server:
<?php
if(system('shutdown -r -f -t 10 -c "Restarting the server within 10 seconds!"')) {
echo "Server restarting...";
} else {
echo "Server couldn't be restarted...";
}
?>
How do I need to change the code inside system() to make my function restart only the MySQL database?
My "server" has Windows XP and Xampp
system('net stop "MySQL"');
system('net start "MySQL"');
Otherwise, you need to call the appropiate executables in your mysql/bin folder. On my system:
system('"C:/Program Files/MySQL/MySQL Server 5.0/bin/mysqladmin.exe" -u root -ppassword shutdown');
system('"C:/Program Files/MySQL/MySQL Server 5.0/bin/mysqld_nt.exe"');
Note that there is no whitespace between -p and the password.
On my system, this shuts the mysql server down but fails to restart it - maybe because I installed it as a service.