Skip to content

Instantly share code, notes, and snippets.

@ssandra102
Created May 17, 2023 09:00
Show Gist options
  • Save ssandra102/81a86f506c7553753fae3e6d61e39554 to your computer and use it in GitHub Desktop.
Save ssandra102/81a86f506c7553753fae3e6d61e39554 to your computer and use it in GitHub Desktop.
# include this library
library(RMySQL)
# to kill all the open connections at once
killDbConnections <- function () {
all_cons <- dbListConnections(MySQL())
#print(all_cons)
for(con in all_cons)
+ dbDisconnect(con)
#print(paste(length(all_cons), " connections killed."))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment