1. How to change the MySQL root user password?
2. How to check whether MySQL Server is up and running?
3. How do I find out what version of MySQL I am running?
Apart from giving the ‘Server version’, this command also displays the current status of the mysql server.
4. What is the current status of MySQL server?
The status command displays the following information:
Uptime: Uptime of the mysql server in seconds
Threads: Total number of clients connected to the server.
Questions: Total number of queries the server has executed since the startup.
Slow queries: Total number of queries whose execution time was more than long_query_time variable’s value.
Opens: Total number of tables opened by the server.
Flush tables: How many times the tables were flushed.
Open tables: Total number of open tables in the database.
5. How to view all the MySQL Server status variable and it’s current value?
6. How to display all MySQL server system variables and the values?
7. How to display all the running process/queries in the mysql database?
You can use this command effectively to debug any performance issue and identify the query that is causing problems, by running the command automatically every 1 second as shown below.
8. How to create a MySQL Database?
Note: To display all tables in a database, total number of columns, row, column types, indexes etc., use the mysqlshow command that we discussed in our previous articles.
9. How to Delete/Drop an existing MySQL database?
10. How to reload/refresh the privilege or the grants tables?
Refresh command will flush all the tables and close/open log files.
11. What is the safe method to shutdown the MySQL server?
12. List of all mysqladmin flush commands.
flush-hosts: Flush all information in the host cache.
flush-privileges: Reload the grant tables (same as reload).
flush-status: Clear status variables.
flush-threads: Flush the thread cache.
13. How to kill a hanging MySQL Client Process?
First identify the hanging MySQL client process using the processlist command.
Now, use the kill command and pass the process_id as shown below. To kill multiple process you can pass comma separated process id’s.
14. How to start and stop MySQL replication on a slave server?
15. How to combine multiple mysqladmin commands together?
In the example below, you can combine process-list, status and version command to get all the output together as shown below.
You can also use the short form. as shown below:
Use the option -h, to connect to a remote MySQL server and execute the mysqladmin commands as shown below.