Search code examples
mysqlintellij-ideaprogrammers-notepad

How to connect IntelliJ with local MySQL?


I have been struggling to learn how the localhost MySQL and IntelliJ to connect and program a database related task. Is that Possible? If yes, how to achieve it?


Solution

  • Connecting to a local instance is essentially the same as connecting to a remote instance of MySQL. Just substitute either localhost, or 127.0.0.1 in place of the IP address you would use normally.

    To add a new database connection (called a data source in IntelliJ), open the Database window View -> Tool Windows -> Databases, then click the + sign and select Data Source and then MySQL from the sub-menu. The defaults for the MySQL connection should for a local install of MySQL.

    To open a connection, right click on your new data source and select Open Console.

    Official IntelliJ Documentation - Managing Data Sources