cat-right

MySQLadmin...

The mysqladmin element you see in MySQL is a client used for a variety of administrative functions. It can be utilized to assess the server status and setup. It can also be used to drop or make databases. The following examples will show how to use mysqladmin.

Usage

You can call up mysqladmin this way:

shell> mysqladmin [options] command [command-arg] [command [command-arg]] …

Supported Commands

create db_name

This will make a new database called db_name or whatever name you assign to it.

debug

This instructs the server to generate debug information in the error log. Starting with MySQL 5.1.12, the command will provide info about Event Scheduler too.

drop db_name

This command will delete the database. All its tables will be deleted as well.

extended-status

This will show the server status variables. The values will be displayed as well.

flush-hosts

It is going to flush the info within the host cache.

flush-privileges

This is going to reload the grant tables. Other flush commands are flush-logs (flushes the logs), flush-status (removes the status variables), flush-tables and flush-threads (this will flush the cache).

kill id,id,…

This will kill the server threads. No spaces must be used on the list if several ID values are provided.

Password Commands

When you study how to use mysqladmin, two password related commands are worth looking into: old-password new-password and password new-password.

old-password new-password

This will keep the password employing the old password=hashing format.

password new-password

This will set the new password. It will alter the password into the new password. This is for the account you utilize with mysqladmin for joining the server. The next time you call up mysqladmin with this account, the new password will be required.

If the new password has spaces or characters special to the command interpreter, they must be set in quotation marks. Users of the Windows OS must utilize double quotation marks. The single quotation marks will be read as a component of the password.

Warning: avoid using this command if the server was commenced using the –skip-grant-tables option. The password change will not take effect. This will hold true even if the command is preceded using flush-privileges.

ping

This is used for checking the availability of the server. The status is 1 if the server is not running. If it is, the status is 0.

As you study how to use mysqladmin, make sure to evaluate the other commands. The more commands you know, the more you will be able to use this client.