-h, --host=hostname Connect to specified host.
-p, --password[=password Specify password to use when connecting to server.
If the password is not given, you will be prompted for one at the console.
-P, --port[=portnumber] Port number to use for connection
-i, --sleep=num Will cause mysqladmin to execute commands again and again,
with a sleep between them of num seconds.
-s, --silent Will cause mysqladmin to silently exit if it can't connect to the
server.
-S, --socket=socket The socket file to use for connection.
-t, --timeout=num Specifies timeout, in seconds, for connection to the mysqld
server.
-u, --user=username Specify username for login if not current system user.
-V, --version Prints version information and exits.
-w, --wait[=retries] Waits and retries specified number of times if database
connection is down.
-?, --help Displays commands and options and exits.Because a number of these options are quite sophisticated, you'll look at some of them in more detail.mysqladmin create databasename
If you have just installed MySQL, or if you want to create a new database, you will need to create a
database, which you can you with mysqladmin create.
Look at a sample session in which I want to log on to MySQL as root and create a database for my
photographs:
[tonyb@tigger tonyb]$ mysqladmin -u root -p create photo_db
Enter password:
Database "photo_db" created.
At this stage, the MySQL database is not much more than an empty directory—mysqladmin has
simply created the photo_db directory on the server.
mysqladmin drop databasename
Should you ever want to drop (or delete) a database, the mysqladmin drop command will do just that.
Suppose that I want to get rid of the database I just created:
[tonyb@tigger tonyb]$ mysqladmin -u root -p drop photo_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 'photo_db' database [y/N]
y
Database "photo_db" dropped
The opposite of create, mysqladmin now deletes the directory containing the photo_db database and
all its contents.Status and Version Information
mysqladmin has a number of ways of providing status and version information about the MySQL server:
mysqladmin status
mysqladmin version
mysqladmin extended-status
mysqladmin variables
The first of these, status, provides a single-line status display on the MySQL server:
[tonyb@tigger tonyb]$ mysqladmin status
Uptime: 80000 Threads: 1 Questions: 168 Slow queries: 0 Opens: 30
Flush tables: 1
Open tables: 26