mysqladmin
Administer MySQL/MariaDB servers
SYNOPSIS
mysqladmin [options] command [command options] ...
PARAMETERS
--help
Display help message and exit.
--version
Display version information and exit.
-u, --user=user_name
User name for connecting to the MySQL server.
-p, --password[=password]
Password for connecting to the MySQL server. If no password is provided the user is prompted
-h, --host=host_name
Host name or IP address of the MySQL server.
-P, --port=port_number
Port number for connecting to the MySQL server.
-S, --socket=socket_path
Path to the MySQL socket file.
-r, --relative
Show difference between current and previous values for certain commands like 'status'.
--ssl*
Options related to establishing SSL/TLS encrypted connections to the server.
DESCRIPTION
mysqladmin
is a command-line utility for performing administrative operations on a MySQL server. It allows you to connect to a MySQL server and execute various commands for managing its configuration, status, and users. You can use mysqladmin
to check server status, create and drop databases, reload grant tables, flush caches, shut down the server, and more. It's a valuable tool for system administrators and database developers who need to interact with MySQL servers from the command line. The utility connects to the MySQL server using credentials provided as command-line arguments or specified in configuration files.
Keep in mind that many mysqladmin
functionalities are available through other tools like the mysql
client and dedicated GUI tools such as MySQL Workbench. However, mysqladmin
remains useful for quick and simple administrative tasks, especially in scripting environments. Because of the potential for authentication information to be visible in process lists, securing appropriate operating system level access is crucial. The use of encrypted connections (TLS/SSL) may be configured separately.
CAVEATS
Authentication details might be visible in the command-line history or process list, posing security risks. Use with caution in shared environments and consider using option files for credentials.
COMMON COMMANDS
Some frequently used commands are:
- create: Creates a new database.
- drop: Deletes a database.
- reload: Reloads the grant tables.
- flush-logs: Flushes the logs.
- ping: Checks if the server is running.
- shutdown: Shuts down the MySQL server.
- status: Displays server status information.
- version: Shows the MySQL server version.
SECURITY CONSIDERATIONS
Always protect your MySQL server by using strong passwords and restricting network access. Consider using SSL/TLS for encrypted connections to protect data in transit. Avoid storing passwords directly in scripts; use option files or environment variables instead.
HISTORY
mysqladmin
has been part of the MySQL distribution since its early versions. It provided a command-line interface for managing MySQL servers at a time when GUI tools were less prevalent. Its functionality has evolved alongside MySQL itself, with features being added and updated to reflect the changing needs of database administrators.
While GUI tools have become more popular for many tasks, mysqladmin
remains a valuable tool, especially in environments where command-line access is preferred or required, such as in scripting and automation.