Skip to content

Instantly share code, notes, and snippets.

@rushipkar90
Created September 11, 2015 15:15
Show Gist options
  • Save rushipkar90/ad4ddcb000e8cc38b9cd to your computer and use it in GitHub Desktop.
Save rushipkar90/ad4ddcb000e8cc38b9cd to your computer and use it in GitHub Desktop.
MySqladmin commands
URL: http://www.tecmint.com/mysqladmin-commands-for-database-administration-in-linux/
20 MySQL (Mysqladmin) Commands for Database Administration in Linux
========================
1. How to set MySQL Root password?
=> # mysqladmin -u root password YOURNEWPASSWORD
2. How to Change MySQL Root password?
=> mysqladmin -u root -p123456 password 'xyz123'
3. How to check MySQL Server is running?
=>
# mysqladmin -u root -p ping
Enter password:
mysqld is alive
4. How to Check which MySQL version I am running?
=> # mysqladmin -u root -p version
5. How to Find out current Status of MySQL server?
=> # mysqladmin -u root -ptmppassword status
6. How to check status of all MySQL Server Variable’s and value’s?
=> # mysqladmin -u root -p extended-status
7. How to see all MySQL server Variables and Values?
=> # mysqladmin -u root -p variables
8. How to check all the running Process of MySQL server?
=> # mysqladmin -u root -p processlist
9. How to create a Database in MySQL server?
=> # mysqladmin -u root -p create databasename
10. How to drop a Database in MySQL server?
=> # mysqladmin -u root -p drop databasename
11. How to reload/refresh MySQL Privileges?
=>
# mysqladmin -u root -p reload;
# mysqladmin -u root -p refresh
12. How to shutdown MySQL server Safely?
=> mysqladmin -u root -p shutdown
13. Some useful MySQL Flush commands
Following are some useful flush commands with their description.
flush-hosts: Flush all host information from host cache.
flush-tables: Flush all tables.
flush-threads: Flush all threads cache.
flush-logs: Flush all information logs.
flush-privileges: Reload the grant tables (same as reload).
flush-status: Clear status variables.
# 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
14. How to kill Sleeping MySQL Client Process?
=> # mysqladmin -u root -p kill 5,10 (Where 5 & 10 is process ID)
15. How to run multiple mysqladmin commands together?
=> # mysqladmin -u root -p processlist status version
16. How to Connect remote mysql server
=> # mysqladmin -h 172.16.25.126 -u root -p
17. How to execute command on remote MySQL server
=> # mysqladmin -h 172.16.25.126 -u root -p status
18. How to start/stop MySQL replication on a slave server?
=> # mysqladmin -u root -p start-slave
# mysqladmin -u root -p stop-slave
19. How to store MySQL server Debug Information to logs?
=> # mysqladmin -u root -p debug
20. How to view mysqladmin options and usage
=> # mysqladmin --help
========================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment