Coda has now been discontinued, in favor of their new native Mac Code editor: nova.
As such this article has now been archived.
Coda 2 has a built-in MySQL editor that allows you to connect to a remote database and editor data, define structure, and more. I’ll use Coda 2 to connect to SiteGround MySQL in this tutorial.
SiteGround is a great host for developers with Git Integration, WordPress CLI, among many other features. It is for this reason I decided to use SiteGround for this tutorial, but the process is very similar for any other host using cPanel.
I first wrote this tutorial back in 2014, and while Coda 2 has a strong following, there are now many other code editors available that now offer MySQL functionality, whether natively or via an extension. Coding editors are very much a personal choice, and while Coda works extremely well, it is no longer the most popular solution.
How to set up Coda 2 with MySQL
How to Connect Coda 2 MySQL with SiteGround
- Log in to your SiteGround Administrative Dashboard
- You will need to log in to your SiteGround account to access all the settings.
- Navigate to your Account Management Screen
- Go to “My Accounts” then “Manage Account.”
The settings must be configured for each account, so you will have to repeat these steps for each account you want access to.
- Copy the IP address for the account you want to connect to
- Under “Account DNS” copy the IP address that’s after ns2.sitegroundXXX.com
- Log in to the cPanel dashboard
- Click the red button titled “Go to cPanel.”
This will automatically log you in to the correct cPanel account.
- Configure Remote MySQL
- Under the “Databases” section select “Remote MySQL.”
- Add Host
- In the “Host” field, paste the IP address from Step 3, and click “Add Host.”
- Add or Select Site in Coda 2
- Add new site, or choose which the site you want to access the MySQL.
- Select MySQL Database Type
- Set “Database Type: MySQL Server.”
- Configure Server IP
- Server: Paste the IP address used in Steps 3 and 6
The default MySQL server port is 3306. If you wish to connect to a PostgreSQL database, the default port would be 5432.
- Enter Database Username and Password
- User Name and Password: Enter the username and password associated with the database you want to access.
Note that you will gain access to all of the databases within your SiteGround count upon providing the information for just one of the databases.
- Specify Default Database Name you wish to access
- Initial Database: This should contain the name of the initial database you want to access.
- You should ensure the name matches precisely. Make sure the username and password above are already users of this database.
- Save and connect!
- Once you have connected, you will be able to add a new MySQL file and use the dropdown on the top left to select which database you wish to connect to.