Linux : Essentials MySQL Admin CLI commands

By | March 7, 2015

Here is a quick list of useful commands for any MySQL database administrator.

Show the server full status :

mysqladmin -u root -p extended-status

You may also sort specific information with “grep” as followed :

mysqladmin -u root -p extended-status | grep Threads

Show the current running process and queries (remove “-i 1” to display once) :

mysqladmin -u root -p -i 1 processlist

Show version and server uptime :

mysqladmin -u root -p version

Change the root password :

mysqladmin -u root -p password 'Your-New-Password'

Show MySQL variables :

mysqladmin -u root -p variables

Create a new database :

mysqladmin -u root -p create dbName

Drop an existing database :

mysqladmin -u root -p drop dbName

Flush priviledges :

mysqladmin -u root -p flush-privileges