Wednesday, 19 February 2014

Some mysqladmin Commands


Mysqladmin is a client program for performing administrative functions on the mysql server.

The following can be done with mysqladmin.

1) Checking the server configuration
2) Create or drop database
3) Shutting down mysql
4) Checking the status of server
5) Change the admin password
6) Stop the replication
7) Check the running queries.


1) Change Password
mysqladmin -u root -p password 'newpassword'
2) Check server status
mysqladmin -u root -p ping
3) Check the version of mysql running
mysqladmin -u root -p version
4) To view the server variables
mysqladmin -u root -p variables
5) To view the server status variables
mysqladmin -u root -p extended-status
6) Queries running on the server
mysqladmin -u root -p processlist
7) Database creation/deletion
mysqladmin -u root -p create mysql_test
mysqladmin -u root -p drop mysql_test
8) Shutdown the server
mysqladmin -u root -p shutdown
9) Kill a query
mysqladmin -u root -p kill query_id
10) Start / stop replication
mysqladmin -u root -p stop-slave
mysqladmin -u root -p start-slave

11) The logs can also be flushed using the mysqladmin command.
mysqladmin -u root -p flush-logs

No comments: