Wednesday 18 January 2012

Mysqladmin Tips


Here we can see some tips with mysqladmin tool

To check the status of mysqld
# mysqladmin -u root -pmysql ping
# service mysqld status
# mysqladmin -u root -pmysql status

To find mysql version
# mysqladmin -u root -pmysql version 

To view all the MySQL Server status variable and it s current value.
# mysqladmin -u root -pmysql extended-status

To display all MySQL server system variables and the values
# mysqladmin -u root -pmysql variables

To display all the running process/queries in the mysql database.
# mysqladmin -u root -pmysql processlist
# mysqladmin -u root -pmysql processlist -i 1  ---- run this command automatically every 1 second.

To create a DB
# mysqladmin -pmysql create DBtest

To Drop a DB
# mysqladmin -pmysql drop DBtest

To reload mysqld demon
# mysqladmin -pmysql reload 
# mysqladmin -pmysql refrsh

To stop mysql daemon
# mysqladmin -pmysql shutdow

Note: You can also use /etc/rc.d/init.d/mysqld stop to shutdown the server. To start the server, execute /etc/rc.d/init.d/mysql start

Mysql flush
# mysqladmin -pmysql flush-hosts 
# mysqladmin -pmysql flush-logs
# mysqladmin -pmysql flush-privileges
# mysqladmin -pmysql flush-status
# mysqladmin -pmysql flush-tables
# mysqladmin -pmysql flush-threads


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.


To start and stop MySQL replication on a slave server
# mysqladmin -u root -pmysql stop-slave
# mysqladmin -u root -pmysql start-slave


No comments:

Post a Comment