avatar Deluxe Blog Tips About Projects

Common MySQL commands

I usually forget basic MySQL commands like checking the status and where is the configuration file. So, I collect the most useful and most used commands for MySQL in this post for a quick reference. Note that I use Ubuntu, so the the commands are Ubuntu-specific.

These commands are extremely useful, especially when you want to manage your own VPS or backup databases. Here we go:

Secure MySQL installation

This command is usually used after installing LAMP/LEMP on the server.


Start, stop, restart MySQL

systemctl start mysql
systemctl stop mysql
systemctl restart mysql


service mysql start
service mysql stop
service mysql restart

Check MySQL status

Checking if MySQL is active or not:

systemctl is-active mysql

For more advanced details, use:

systemctl status mysql

MySQL configuration file

/etc/mysql/ - Main MySQL server configuration directory
/etc/mysql/my.cnf - The MySQL database server configuration file

The my.cnf simly loads config from these folders:


In most cases, you might need to edit this file:


🔥 HOT: Interested in boosting your WordPress SEO? My Slim SEO plugin is a super lighweight and automated plugin that handles most the hard work for you: meta tags, sitemap, redirection, schema & link building.

👉 Have a look and you will love it: wpslimseo.com