mycli(1)
A terminal-based MySQL client with syntax highlighting, auto-completion, and smart suggestions.
Synopsis
mycli [OPTIONS] [DATABASE]Description
mycli is a command-line interface for MySQL and MariaDB that improves upon the standard mysql client with modern terminal features. It provides syntax highlighting, intelligent auto-completion based on database schema, history search, and formatted query output.
Connect to local or remote MySQL servers, execute queries interactively or in batch mode, and navigate databases with a user-friendly interface that supports vi-key bindings and mouse interaction.
Common options
| Flag | What it does |
|---|---|
-u, --user | MySQL user name |
-p, --password | Prompt for password (or provide directly, not recommended) |
-h, --host | Host address of the MySQL server (default: localhost) |
-P, --port | Port number to connect to (default: 3306) |
-e, --execute | Execute query and exit without entering interactive mode |
--no-auto-escape | Disable automatic escaping of special characters in input |
--single-connection | Use a single connection for all queries instead of per-statement |
--ssl | Use SSL for the MySQL connection |
-A, --auto-vertical-output | Automatically switch to vertical output when result is too wide |
--login-path | Read connection parameters from a named .mylogin.cnf entry |
Examples
Connect to local MySQL server as root user and open database mydb interactively
mycli -u root -h localhost mydbConnect to remote MySQL server with password prompt and select production database
mycli -u admin -p -h db.example.com productionExecute a single query and exit without entering interactive mode
mycli -u user -p -e "SELECT * FROM users LIMIT 5;" mydbConnect using credentials stored in .mylogin.cnf under the 'myserver' profile
mycli --login-path=myserverConnect and automatically switch to vertical output for wide result sets
mycli -u root -A mydbConnect to non-standard port 3307 on a remote server
mycli -u admin -p -h 192.168.1.100 -P 3307 testdb