📢 Found an issue or want to request a new tool? Open an issue on GitHub
Command line client for MySQL.
# Interactive mode
docker run -it --rm \
ghcr.io/pabpereza/toolkitbox/mysql:latest \
mysql -h my-server.com -u root -p
# Run single query
docker run --rm \
ghcr.io/pabpereza/toolkitbox/mysql:latest \
mysql -h my-server.com -u root -pPASSWORD -e "SHOW DATABASES;"
apiVersion: v1
kind: Pod
metadata:
name: mysql-client
spec:
containers:
- name: mysql-client
image: ghcr.io/pabpereza/toolkitbox/mysql:latest
command: ["sleep", "infinity"]
env:
- name: MYSQL_HOST
value: "mysql-service"
- name: MYSQL_USER
value: "root"
- name: MYSQL_PWD
valueFrom:
secretKeyRef:
name: mysql-credentials
key: password
MySQL Client (mysql) is the official command line tool for connecting to MySQL servers. It allows you to execute interactive SQL queries, scripts, and perform database administration tasks.
This component installs mysql-client from the Alpine Linux repositories.
mysql -h hostname -u user -p
mysql -h hostname -u user -p database_name
mysql -h hostname -u user -p -e "SHOW DATABASES;"
mysql -h hostname -u user -p database < backup.sql
mysqldump -h hostname -u user -p database > backup.sql
mysqldump -h hostname -u user -p --all-databases > full_backup.sql
mysqldump -h hostname -u user -p --no-data database > schema.sql
| Option | Description |
|---|---|
-h, --host | Server to connect to |
-P, --port | Port (default: 3306) |
-u, --user | Connection user |
-p, --password | Prompt for password |
-D, --database | Database to select |
-e, --execute | Execute command and exit |
-N, --skip-column-names | Don't show column names |
-B, --batch | Batch mode (no table formatting) |
-- Show databases
SHOW DATABASES;
-- Use database
USE database_name;
-- Show tables
SHOW TABLES;
-- Describe table structure
DESCRIBE table_name;
-- Show active processes
SHOW PROCESSLIST;
-- View server variables
SHOW VARIABLES LIKE '%max_connections%';
v5.6 - MySQL 5.6v5.7 - MySQL 5.7Content type
Image
Digest
sha256:dd507bfee…
Size
17.7 MB
Last updated
17 days ago
docker pull toolkitbox/mysql