====== Connecting to databases ====== ===== MySQL ===== To connect to the MySQL server, use either ''localhost'' as the hostname and port //3306//, or a local UNIX socket at ''/tmp/mysql.sock''. All connections must be authenticated using a valid MySQL user (see [[users|Managing users]]), and the particular user must have access privileges assigned to access the database. ===== PostgreSQL ===== To connect to the PostgreSQL server, use ''localhost'' as the hostname and port //5432//. Do **not** use a local UNIX socket. All connections must be authenticated using your main account user and password. ===== Remote connections ===== Joyent doesn't allow direct remote connections to either MySQL or PostgreSQL. You //may// though use SSH tunneling to create a secure tunnel to the server that will carry MySQL or PostgreSQL connections through - from your workstation to the local ports on the server. It is important that you set the tunnel up to connect to ''127.0.0.1:3306'' for MySQL or ''127.0.0.1:5432'' for PostgreSQL respectively. See [[tunneling|SSH tunneling]] for a general help on setting up SSH tunnels. Please do not leave SSH based tunnels to either MySQL or PostgreSQL open for longer than absolutely necessary.