The Most Active and Friendliest
Affiliate Marketing Community Online!

“Adavice”/  “1Win

tip : performaing basic administration tasks using mysqladmin

D

dman_2007

Guest
Mysql server comes with a very handy command line utility called mysqladmin. It can be used to perform basic server administration tasks easily. Basic format of using mysqladmin is :

mysqladmin [options] command [command-options] [command [command-options]] ...

command specifies the administration task that mysqladmin has to perform. Following is the list of important commands mysqladmin supports :

1) create db_name

Create command can be used for creating a new database. The user specified must have the proper privileges to be able to create the new database, otherwise the command will fail. Example :

mysqladmin -u test-user -p create test-db

the command given above prompts for the password for test-user and after reading the password, it connects to mysql server as test-user. After successful login, it will try to create a new db named test-db.

I'll discuss more commands in my next post.
 
2) drop db_name

This command is used for deleting an existing database. Again, the user specified must have the proper privileges to be able to delete the database, otherwise the command will fail. Example :

mysqladmin -u test-user -p drop test-db

3) flush-privileges

This command is same as reload command. It can be used for reloading privilege grant tables. Example,

mysqladmin -u root -p flush-privileges

4) password new-password

password command is used for changing the password of the user you use to connect to mysql server. EXample,

mysqladmin -u root -p password 'sample-password'

5) ping

pings to check whether the server is working or not. Example,

mysqladmin -u test-user ping

6) reload

This command reloads the privilege grant tables. Example,

mysqladmin -u root -p reload

7) shutdown

stops mysql server. Example,

mysqladmin -u root -p shutdown

8) status

This command when used displays mysql server status. Example,

mysqladmin -u test-user status

9) variables

This command is used for displaying server system variables and their values. Example,

mysqladmin -u test-user variables
 
banners
Back