I’m working with Emacs and its built-in SQL interactive functionality to connect to MySQL databases. This has been working great for me so far. However, I now need to connect to a different MySQL instance that runs on a custom port instead of the standard 3306 port. When I try to use the sql-mysql command, I can’t figure out how to specify which port to connect to. Is there a way to tell Emacs which port number to use when establishing the MySQL connection? It would be really helpful if there was an option to either set a custom port or have Emacs ask me for the port during connection setup.
you can set the sql-port var before your connection using M-x set-variable RET sql-port RET 3307. then just run sql-mysql like normal. that’s how i do it for other ports.