Connect to a private mysql instance from your favorite IDE
Connect to MySQL
Open a new terminal and type
plain texthoop connect mysqldb
plain textconnection: mysqldb | session: 0ebc7492-94bf-498e-ac9c-430f2d5e89b0 ---------------------mysql-credentials---------------------- host=127.0.0.1 port=5433 user=noop password=noop ------------------------------------------------------------ ready to accept connections!
Use It
Connect to mysql using any IDE, example:
plain textmysql -h 0 -p 3307
mysql cli
An optional way to connect into MySQL is using the
mysql
client. It’s possible to create a interactive session or execute one-off commands.Connection Configuration
Name | Type | Description |
HOST | env-var | The IP or Host of the MySQL server |
PORT | env-var | The port of the MySQL server |
USER | env-var | The user to connect in the MySQL server |
MYSQL_PWD | env-var | The password to connect in the MySQL server |
DB | env-var | The name of the database to connect into |
Connection Command
plain textmysql -h$HOST -u$USER --port=$PORT -D$DB
:::info NOTE The
MYSQL_PWD
is mapped as an environment variable, thus there’s no need to use it in the command. :::How to Use
Start an interactive session with mysql client
plain texthoop connect mysql
In the same connection, one-off process can be run as well
plain texthoop exec mysql <<EOF SELECT SLEEP(2); SELECT NOW(); EOF
plain texthoop exec mysql -f /tmp/myquery.sql hoop exec psql -i 'SELECT NOW()'