When using the usual service shutdown is not enough (MySQL is still active, even though you have issued “service mysqld stop” or “/etc/init.d/mysql stop”), you can use this alternate method for a graceful shutdown :
mysqladmin -uroot -p -h127.0.0.1 --protocol=tcp shutdown
Or :
mysqladmin -uroot -p -h127.0.0.1 shutdown