How to use mysqladmin to manage mysql server efficiently
Useful mysqladmin to manage mysql server efficiently
mysqladmin is a command-line function used by System Administrator or Database Administrators to perform some basic MySQL tasks easily and efficiently. Using this mysqladmin you can perform mysql works easily such as changing root password, monitoring mysql processes, reloading privileges, checking server status and process status list and many more. How to use this mysql admin is explained in this article.
To Check your mysql server
Using ping option you can easily identify mysql server is active or not.
[root@linuxhelp Desktop]# mysqladmin -u root -p ping
Enter password:
mysqld is alive
To Check the version of mysql server
Using version option along with mysqladmin you can easily identify current version of mysql server.
[root@linuxhelp Desktop]# mysqladmin -u root -p version
Enter password:
To Check the current status of mysql server
Using status option you can check the mysql status such as uptime, query details, etc&hellip
[root@linuxhelp Desktop]# mysqladmin -u root -p status
Enter password:
Uptime: 16566 Threads: 1 Questions: 183 Slow queries: 0 Opens: 96 Flush tables: 2 Open tables: 28 Queries per second avg: 0.011
To check the variable and values status information of mysql server
Using extended-status option, it will show all the running status of mysql server variable and values.
[root@linuxhelp Desktop]# mysqladmin -u root -p extended-status
Enter password:
Check all the variable and values of mysql server with the following command.
[root@linuxhelp Desktop]# mysqladmin -u root -p variables
Enter password:
To check all running process of mysql server
If you want to view all running process of the mysql server, use processlist option along with mysql admin command.
[root@linuxhelp Desktop]# mysqladmin -u root -p processlist
Enter password:
To Create Database
Use the following command to create database.
[root@linuxhelp Desktop]# mysqladmin -u root -p create test_db
Enter password:
Now check whether your DB is created in mysql server .
[root@linuxhelp Desktop]# mysql -u root &ndash p
Remove or Drop the database
If you want to remove the database from the mysql server, use drop option and enter the db name which you want to delete.
[root@linuxhelp Desktop]# mysqladmin -u root -p drop test_db
Enter password:
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.
Do you really want to drop the ' test_db' database [y/N] y
Database " test_db" dropped
Reload or Refersh the mysql server using the following command.
[root@linuxhelp Desktop]# mysqladmin -u root -p reload Enter password: [root@linuxhelp Desktop]# mysqladmin -u root -p refresh Enter password:
To kill the process in mysql server
If you want to kill the process in mysql server, list the current running process.
[root@linuxhelp Desktop]# mysqladmin -u root -p processlist
Enter password:
After listing the running process, select the process to kill by running the following command.
[root@linuxhelp Desktop]# mysqladmin -u root -p kill 48
The number 48 id process id for the mysql server process.
Run the multiple process in one command.
[root@linuxhelp Desktop]# mysqladmin -u root -p processlist status version
Enter password:
Reset the mysql root password. Enter the old mysql root password using &ndash p option and enter the new mysql root password after password option.
[root@linuxhelp Desktop]# mysqladmin -u root -plinuxc password ' redhat'
To reload the grant tables
root@linuxhelp Desktop]# mysqladmin -u root -p flush-privileges
Enter password:
To flush all caches of mysql server
[root@linuxhelp Desktop]# mysqladmin -u root -p flush-threads
Enter password:
To flush all tables of mysql server
[root@linuxhelp Desktop]# mysqladmin -u root -p flush-tables
Enter password:
To flush all log information in mysql server
[root@linuxhelp Desktop]# mysqladmin -u root -p flush-logs
Enter password:
To store MySQL server Debug Information to logs
[root@linuxhelp Desktop]# mysqladmin -u root -p debug
Enter password:
To shut down the mysql server
[root@linuxhelp Desktop]# mysqladmin -u root -p shutdown
Enter password:
To view more information about mysqladmin use --help option
[root@linuxhelp Desktop]# mysqladmin --help
Comments ( 0 )
No comments available