Skip to content

MySQL Commands

February 19, 2013

* To Check MySQL server is running or not use command
Mysql0

* To Check Which MySQL Version is use following command
mysql2

* To Check Current Status of MySQL server
mysql3

* To Check Status of all MySQL Server Variable’s and Value’s use the following command
# mysqladmin -u root -p extended-status

* To See all MySQL Server Variables and Values
# mysqladmin -u root -p variables

* Check all running process of MySQL server
#mysqladmin -u root -p processlist

* Create New Database in MySQL
# mysqladmin -u root -p create (Database name)

* Drop Database in MySQL
# mysqladmin -u root -p drop (Database Name)

* Reload MySQL Privileges (which reloads the grant tables)
# mysqladmin -u root -p reload;

* Refresh MySQL Privileges (flushes all tables and reopen log files)
# mysqladmin -u root -p refresh;

* Shutdown/Stop/Start MySQL Server
# mysqladmin -u root -p shutdown
# mysqladmin -u root -p stop
# mysqladmin -u root -p start

* All flush commands (MySQL Server)
# mysqladmin -u root -p flush-hosts
# mysqladmin -u root -p flush-tables
# mysqladmin -u root -p flush-threads
# mysqladmin -u root -p flush-logs
# mysqladmin -u root -p flush-privileges
# mysqladmin -u root -p flush-status

* Kill Sleeping MySQL Client Process
Find the sleeping process Id with below command:
# mysqladmin -u root -p processlist
Now kill that process with below command
# mysqladmin -u root -p kill (Process ID)
For killing multiple processes
# mysqladmin -u root -p kill (process ID-1),(Process ID-2)….

* Connect Remote MySQL server
# mysqladmin -h (Remote MySQL server IP) -u root -p

* Executing commands on Remote Server
# mysqladmin -h (Remote MySQL server IP) -u root -p status

Advertisements

From → Linux

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: