Sign inSign up

toolkitbox/mariadb

By toolkitbox

•Updated 18 days ago

DevOps toolkit - mariadb client

Image
0

1.7K

toolkitbox/mariadb repository overview

⁠MariaDB Client

GitHub Stars GitHub Issues Docker Pulls

📢 Found an issue or want to request a new tool? Open an issue on GitHub⁠

Command line client for MariaDB/MySQL.

⁠Quick Start

⁠Docker
# Interactive mode
docker run -it --rm \
  ghcr.io/pabpereza/toolkitbox/mariadb:latest \
  mariadb -h my-server.com -u root -p

# Run single query
docker run --rm \
  ghcr.io/pabpereza/toolkitbox/mariadb:latest \
  mariadb -h my-server.com -u root -pPASSWORD -e "SHOW DATABASES;"
⁠Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: mariadb-client
spec:
  containers:
  - name: mariadb-client
    image: ghcr.io/pabpereza/toolkitbox/mariadb:latest
    command: ["sleep", "infinity"]
    env:
    - name: MYSQL_HOST
      value: "mariadb-service"
    - name: MYSQL_USER
      value: "root"
    - name: MYSQL_PWD
      valueFrom:
        secretKeyRef:
          name: mariadb-credentials
          key: password

⁠Description

MariaDB Client (mariadb / mysql) is the command line tool for connecting to MariaDB and MySQL servers. It allows you to execute SQL queries, manage databases, import/export data, and manage users.

⁠Installation

This component installs mariadb-client from the Alpine Linux repositories.

⁠Basic Usage

⁠Connect to a server
mariadb -h hostname -u user -p
⁠Connect specifying database
mariadb -h hostname -u user -p database_name
⁠Execute direct query
mariadb -h hostname -u user -p -e "SELECT * FROM table"
⁠Import SQL file
mariadb -h hostname -u user -p database < backup.sql
⁠Export database (dump)
mariadb-dump -h hostname -u user -p database > backup.sql
⁠Export structure only
mariadb-dump -h hostname -u user -p --no-data database > schema.sql

⁠Common Options

OptionDescription
-h, --hostServer to connect to
-P, --portPort (default: 3306)
-u, --userConnection user
-p, --passwordPrompt for password
-D, --databaseDatabase to select
-e, --executeExecute command and exit

⁠Available Legacy Versions

  • v10.3 - MariaDB 10.3
  • v10.4 - MariaDB 10.4

⁠Official Documentation

Tag summary

Content type

Image

Digest

sha256:174d478bd…

Size

17.7 MB

Last updated

18 days ago

docker pull toolkitbox/mariadb