shorn
By:
shorn

DO + Serverpilot, Accessing mysql database issues

September 27, 2016 1k views
MySQL Ubuntu 16.04 Ubuntu

Hi,
I'm looking for assistance as this issue has got me beat!

OK, so i'm looking at setting up a basic droplet to run a Craft CMS site. I've set up quite a few of these in the past using Serverpilot. Everything works well.

Today I decided to try the LEMP stack on Ubuntu 16.04. Installed nicely, managed to get everything that I needed installed however I'm having issues with the database. I've created a new database, added a new user and granted all permissions to them. Check and can access that database via the terminal.

I use Sequel Pro on my local machine and I wanted to import my exported local database but I cannot for the life of me access the database. Just keeps saying it cannot connect. Finally managed to get into it using the SSH option and imported the local database. Then when Craft tries to connect to the database, it gives a 'cannot connect' error as well.

So after ages of trying, I decided to go back to a Serverpilot set up. Destroyed my droplet, recreated a basic Ubuntu one, then used Serverpilot to create the app and database. Same issue again, unable to access the database from Sequel Pro.

I cannot work out what is going wrong? In each case Ive attempted the commenting out the bind address, but again, nothing works.
Any ideas before I lose what little hair i have left?
Thanks!

5 comments
  • Do you think it could be an IPTABLES Thing?

    Try this on your server:

    sudo iptables -P INPUT ACCEPT
    sudo iptables -P OUTPUT ACCEPT
    sudo iptables -F

    ..that will open up your server firewall (temporarily..should go back to normal after restart)

    if you can connect after that, there are some ITPABLE rules that will open up the proper ports for that...
    If it still does not connect, then it is a different problem.

  • Just tried, no joy :(

  • are you using SSH to connect to the database from SQL Pro?

  • I've managed to connect through SSH using Sequel Pro, but Craft connects with just the database username and password and it reports that it cannot connect.

    I effectively followed this tutorial https://serverpilot.io/community/articles/how-to-install-craft-cms.html
    but Craft will not connect to the database.

  • So you can access the database from SQL Pro, and also from the command-line, but not from craft, after you properly filled out the db.php page..

    Are your settings correct? What host is it set to? I imagine it is default at "localhost" but you can also try 127.0.0.1

    Do you have phpMyadmin installed? I find it useful for trouble-shooting, but of course you can do it all from command-line just as well.

    My guesses:
    *The db.php is not filled out correctly, or your permissions are wrong on that file so craft cannot read it
    *your user you created for that database is not set up properly (but I doubt this since you can access from command

3 Answers

So after ages of trying, I decided to go back to a Serverpilot set up. Destroyed my droplet, recreated a basic Ubuntu one, then used Serverpilot to create the app and database. Same issue again, unable to access the database from Sequel Pro.

I cannot work out what is going wrong? In each case Ive attempted the commenting out the bind address, but again, nothing works.

When using ServerPilot, to access the database remotely through Sequel Pro you should use the Sequel Pro option to tunnel through SSH. If you need to instead open up MySQL publicly rather than using an SSH tunnel, you'll need to both reconfigure the MySQL bind address and open up the firewall to expose MySQL. There's a bit more info here:

https://serverpilot.io/community/articles/connect-to-mysql-remotely.html

anyone who uses serverpilot, please join to the unofficial slack discussion community hub, for sharing experiences about doing missing (premium) features in free plan 😉

http://serverpilot-slack.herokuapp.com/

Have another answer? Share your knowledge.