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, so I will leave it there.
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.
About the author
Jonathan Griffin. Editor, Hosting Expert, SEO Developer, & SEO Consultant.
Jonathan is currently the Editor & CEO at The Webmaster. He is also an SEO Developer offering consultancy
services, primarily to other web development companies. He specializes in the technical side of SEO,
including site audits, development of SEO related features, and site structure & strategy.
In his spare time, Jonathan has a passion for learning. He regularly undertakes professional courses on
subjects ranging from python, web development, digital marketing, and Advanced Google Analytics.
Read more about Jonathan Griffin on our About Page.