Opens an interactive session to a MySQL server through the mysql CLI or a graphical client.
Run mysql -h host -P port -u user -p database
. The client prompts for the password and drops you into an interactive shell.
Add flags such as --ssl-mode=REQUIRED
, --connect-timeout=10
, or --protocol=TCP
. Combine options in one line to automate secure logins.
Create a new connection, fill Host, Port (3306), Username, and Password, pick the default database, and click Test Connection. Save the profile for one-click reuse.
Common causes are wrong host, blocked port 3306, insufficient privileges, or the server enforcing SSL. Validate each parameter and check firewall rules.
Use least-privilege users, mandate SSL, rotate passwords, and script mysqladmin ping
checks in CI pipelines to catch outages early.
You can set MYSQL_PWD
, but it exposes the password to other users via ps
. Prefer a ~/.my.cnf
file with correct permissions.
Expose port 3306 (-p 3306:3306
) and connect to the host's IP. Example: mysql -h 127.0.0.1 -P 3306 -u root -p
.
Galaxy, DBeaver, TablePlus, and DataGrip all support MySQL, offering query editing, visual explain plans, and secure connection profiles.