exit mysql ubuntu code example Example 1: mysql stop ubuntu service mysqld stop Example 2: stop mysql ubuntu sudo /etc/init.d/mysql stop