comake

Member
Sep 10, 2006
16
0
151
Hello,

I would like to restart Mysql every special hours of the day like 8 PM. Because I have more than 5000 visits/day and the server is very slow and the site display a blank page.
When I see logs, there is always Mysql problems.

I am a newbie.

Someone know how I could make a cron on Cpanel or a special task on Web host manager to reboot Mysql at 2PM, 8PM and 11PM every day ?
 

AndyReed

Well-Known Member
PartnerNOC
May 29, 2004
2,217
4
193
Minneapolis, MN
When I see logs, there is always Mysql problems.
The problem is definitely not MySQL. The problem might be caused by a malicious script or a "runaway script" which can continuously loop, dragging down MySQL resources. You need find out the real cause and stop it from killing your server. Just in case you have time, read more about the causes of high server load:

http://www.vbulletin.com/forum/showthread.php?t=19275
 

comake

Member
Sep 10, 2006
16
0
151
Hello,


Thank you for your answers. I am very newbie and I don't know how to find the error and I will not be able to correct it too.

I just want to run :

/etc/init.d/mysql restart

at a special hour of the day.

Do you know the command to restart apache too ?
 
Last edited:

neo32

Registered
Apr 9, 2006
4
0
151
Hello....comake

here is a example to run a cron to restart mysql at 8.00am every day.

* 8 * * * /etc/init.d/mysql restart

If you have aany further clarification then please contact me at [email protected]

All the best.. :)
 

comake

Member
Sep 10, 2006
16
0
151
Hello, I try on Cpanel Cron panel. I have receveid this email error message

cat: /var/lib/mysql/comake.comake.com.pid: Permission denied
Shutting down MySQLkill: usage: kill [-s sigspec | -n signum |
-sigspec] [pid | job]... or kill -l [sigspec]
................................... ERROR!
rm: cannot remove `/var/lock/subsys/mysql': Permission denied
Starting MySQL SUCCESS!
Do you think MySQL have been restarted or not ?
 

vijeesh

Member
May 26, 2006
23
0
151
You need to setup cron in the root user level to shedule mysql restart on the server
 

HelloAdam

Well-Known Member
Nov 6, 2005
145
0
166
Hey,

What other forgot to say was you need to do this.

In SSH type,

Code:
crontab -e
then you want to input

Code:
* 1 * * * /etc/init.d/mysql restart
This hit on your keyboard

Code:
CTRL X
and y then enter

That will do it!

You may also think about getting a Server Management. Where people who know servers take care of it.

This will restart MySQL every 1 hour for every day, every week, every month, every year.
 

comake

Member
Sep 10, 2006
16
0
151
Thank you.

I want to make a cron to repair mysql database with this command :
mysqlcheck -r -u mysqlusername -p databasename
But SSH ask me the password of mysql database everytime I do this. How to include the password in the ssh sentence ?
 

jmarcv

Member
Jan 31, 2004
6
0
151
co
create this file:
/root/.my.cnf
[client]
user="mysqlusername"
pass="mysqluserpass"

then you only have to type

mysqlcheck -r databasename


or

mysqlcheck -r -u mysqlusername -p mysqluserpass databasename
 
Thread starter Similar threads Forum Replies Date
G Databases 1
P Databases 0