I'm running very hard php script on my cheap virtual machine, which has about half million page views a week so it's a bit problematic. I restart my mysql twice a day. That wouldn't be problem, but when restarting mysql
/etc/init.d/mysql restart
it restarts and then it sometimes says that Table './forum/phpbb_posts' is marked as crashed and last (automatic?) repair failed
This table has nothing to do with that hard script, however it's 250 000 (1.8 gig) table which seems to crash. It takes about 14 minutes to repair that one.
Is there a safer way to stop mysql? I know I should do backups, and I do so, but only once a day and datas are still growing (not fast these days)
Currently running on Debian GNU/Linux 6.0
Best Answer
503 the website to stop activity (.htaccess maintenance mode) and start top to monitor mysqld cpu usage
mysqladmin -p flush-tables
watch mysql activity (may take several minutes, depending on your installation) and when it tapers off
mysqladmin -p flush-tables
to just be sure and then
mysqladmin -p shutdown
This sequence ensures that your website ceases to create more database requests, tells mysql to flush data in memory and transaction log files to the database tables and then initiates a proper database daemon shutdown.