I have a lot of tabs and queries open in MySQL workbench. I left it open before I went to sleep, but this morning I am getting an error MySQL server has gone away when trying to run queries.
The database is up, and I am able to connect to it if I open a new connection on MySQL workbench, but the current connection is dead. How do I reconnect?
I don't want to open a new connection as I would have to copy my queries and tabs over.
Done it.
Query Menu -> Reconnect to Server
Related
If MySQL Workbench CE loses its connection to a server (e.g. when my laptop goes to sleep), it opens a login window for that server. I cannot then close Workbench without logging in to the server again, even if I do not need to run any further queries there. If I close the login window it reopens again before I have chance to close Workbench. I keep the server passwords in a password keeper, so I have to log into two systems unnecessarily.
Is there a way to close Workbench without logging in to the server again?
I am on version 6.3, but I think the behaviour is common to others.
What is the quickest way to open a command-line interface to a Google Cloud SQL database?
I like the old-school mysql command line interface, so currently I open a terminal from the cloud console and then connect with gcloud sql connect .... This then shows a message "Allowlisting your IP for incoming connection for 5 minutes.." which then sits for well over than a minute before the password prompt is given.
Compounding things, the cloud console disconnects if you leave the tab for 10 minutes so you have to do it all over again.
Are there any options to more quickly open a mysql command line client for quick queries? Should I spin up a linux server and connect from there? Load a MySQL client on my PC and connect from there? All of those are extra steps that I have to figure out, so I was wondering which connection method will give me the quickest connection speed just for simple querying.
Use Cloud SQL Auth Proxy with a local database client, but just keep the proxy running
I use SQL workbench to connect postgresql. But I frequently get following error
This connection has been closed.
when ever I kept the window idle for 2-3 minutes.
I am not sure where to the change the settings. Please help me .
Version : Build 118.7
If the server is configured to disconnect idle connections, you can configure a statement that is sent to the database server in regular intervals.
This is done in the connection profile. Click on the "Connect scripts" button:
Connection dialog
Then enter a statement for "Statement to keep connection alive".
Connect scripts
In the "Idle time" you can configure how often the statement should be executed. "1m" means that it's run every minute unless you run statements manually (or do something in the DbExplorer)
This should prevent the server to disconnect your session.
I am using pgAdmin to connect remotely to my database as phpPgAdmin is a bit limited in its features. Only problem is if I leave the SQL window open without running a query for a few minutes, then it says I need to reconnect.
Is this a setting I need to change in my database to keep remote connections alive for longer or is it a pgAdmin setting?
It is client setting.
You need specify connect_timeout in your config file.
29.1. Database Connection Control Functions
29.14. The Connection Service File
Assuming that no statements to close the connection are made before my script ends and no exception is encountered before closing the connection, does the database's connection stay open?
I'm connecting to the database programmatically via Python Psycopg2 and via Java JDBC4 driver.
Not entirely sure what you want exactly, but let's try:
You can see the connections that exist at any time with PGAdmin or this SQL command
SELECT * FROM pg_stat_activity;
It should be fairly simple to spot when - for your specific use case - the connection closes.
If an SQL query is running at the time you close a connection, I think it will run to completion, ie the backend serving it will remain alive, even if the connection is closed from the client side.