Format of mysqladmin tool:
Mysqladmin [option] command [command option] command ......
Option options:
-C number indicates the number of automatic runs, which must be used with-I.
-How long is the I number interval repeated?
Check the status of the server once every two seconds, and repeat the status five times in total.
./Mysqladmin-uroot-p-I 2-c 5 status
-#, -- Debug [= name] Output debug log. Often this is 'd: t: o, filename '.
-F, -- force Don't ask for confirmation on drop database;
Multiple commands, continue even if an error occurs. The error is disabled. if the database is dropped, no prompt is displayed. if multiple commands are executed, an error occurs and the execution continues.
-C, -- compress Use compression in server/client protocol.
-- Character-sets-dir = name directory of the character set
Directory where character sets are.
-- Default-character-set = name: set the default character set.
Set the default character set.
-?, -- Help Display this help and exit. Display help
-H, -- host = name Connect to host. Connection host name or iP address
-P, -- password [= name]: The logon password. If it is not written as a parameter, a prompt is displayed.
Password to use when connecting to server. If password is
Not given it's asked from the tty.
-P, -- port = # Port number to use for connection. Specify the database port
-- Protocol = name The protocol of connection (tcp, socket, pipe, memory). Specify The connection protocol
-R, -- relative Show difference between current and previous values when
Used with-I. Currently works only with extended-status. The value that changes before and after the display must be combined with-I
./Mysqladmin-uroot-p-I 2-r extended-status
If the displayed uptime is always 2, the difference is only 2 compared with the previous result.
-O, -- set-variable = name
Change the value of a variable. Please note that this
Option is deprecated; you can set variables directly
-- Variable-name = value. Modify the value of a variable. This option is no longer used. Use -- variable-name = value to modify the value of a variable.
-S, -- silent Silently exit if one can't connect to server.
-S, -- socket = name Socket file to use for connection. Specify socket file
-I, -- sleep = # Execute commands again and again with a sleep between. Execute once at intervals
-U, -- user = name User for login if not current user. login database username
-V, -- verbose Write more information. Write more information
-V, -- version Output version information and exit. display version
./Mysql-uroot-p-V
-E, -- vertical Print output vertically. Is similar to -- relative,
Prints output vertically.
-W, -- wait [= #] Wait and retry if connection is down. if the connection is disconnected, wait for the time specified by w and try again.
-- Connect_timeout = #
-- Shutdown_timeout = #
1. Check the status of the server: status
./Mysql-uroot-p status
Display result:
Uptime: 4883162 Threads: 1 Questions: 86 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 18 Queries per second avg: 0.000
2. Modify the root password:
Mysqladmin-u root-poldpassword password 'newpassword'
3. Check whether mysqlserver is available:
Mysqladmin-uroot-p ping
Display result:
Mysqld is alive
4. query the server version
Mysqladmin-uroot-p version