MySQL Commands For Database Administration

In this article we’ve compiled some very useful ‘mysqladmin’ commands that are used by system/database administrators in their day-to-day work. You must have MySQL server installed on your system to perform these tasks.

How to change MySQL root password:

If you want to change MySQL password, then you need to type the following command. For example suppose your old password is ‘oldpass’ and you want to change it with new password ‘newpass’# mysqladmin -u root -oldpass password 'newpass'

How to check MySQL Server is running:

To find out whether MySQL server is up and running or not, use the following command.# mysqladmin -u root -p ping

Enter password:
mysqld is alive

How to Check which MySQL version I am running:

The following command shows MySQL version along with the current running status.

# mysqladmin -u root -p version

How to Find out current Status of MySQL server:

To find out current status of MySQL server, use the following command. The mysqladmin command shows the status of uptime with running threads and queries.# mysqladmin -u root -ptmppassword status

How to create a Database in MySQL server:

To create a new database in MySQL server, use the command as shown below.# mysqladmin -u root -p create databasename

Enter password:

How to List all MySQL Databases:

To find all the databses on the MySQL database server, use the command as show below# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18027
Server version: 5.5.28 MySQL Community Server (GPL) by Remi