init-mysql.el 735 B

12345678910111213141516171819202122232425
  1. ;;set up a way to connect to a remote MySQL database
  2. (setq sql-connection-alist
  3. '((pool-a
  4. (sql-product 'mysql)
  5. (sql-server "72.12.197.59")
  6. (sql-user "testuser")
  7. (sql-password "testuser")
  8. (sql-database "take_home_test")
  9. (sql-port 5507))
  10. ))
  11. (defun sql-connect-preset (name)
  12. "Connect to a predefined SQL connection listed in `sql-connection-alist'"
  13. (eval `(let ,(cdr (assoc name sql-connection-alist))
  14. (flet ((sql-get-login (&rest what)))
  15. (sql-product-interactive sql-product)))))
  16. (defun sql-local ()
  17. "Connect to the local MySQL server"
  18. (interactive)
  19. (sql-connect-preset 'pool-a)
  20. (delete-other-windows))
  21. (define-key global-map [f10] 'sql-local)