No database connection...

May 8, 2015 895 views
Linux Basics Apache MySQL Deployment Ubuntu

Hello,

Here I am trying to launch my first website through a digital ocean vps.

I have configured LAMP according to digital ocean guides, but the website does not make the connection to the database.

I have tested the website in local and it works perfectly, I am guessing this issue has something to do with apache or mysql setup?

Below are the commands entered so far... What am I missing or doing wrong?? (Im using Ubuntu 14.04)

Any advice is welcomed, thank's in advanced :)

  • * * sudo apt-get update
  • * * sudo apt-get install apache2 * * *
  • * * sudo apt-get install php5 libapache2-mod-php5 php5-
  • * * mcrypt
  • * * sudo service apache2 restart * * *
  • * * sudo apt-get update
  • * * sudo apt-get install mysql-server
  • * * sudo mysqlinstalldb
  • * * sudo mysqlsecureinstallation
  • * * sudo nano /etc/mysql/my.cnf
  • * * bind-address = yourdatabaseIP
  • * * sudo service mysql restart * * *
  • * * PhpMyAdmin: sudo apt-get install phpmyadmin apache2-utils
  • * * sudo nano /etc/apache2/apache2.conf
  • * * Include /etc/phpmyadmin/apache.conf
  • * * sudo service apache2 restart
1 comment
  • what CMS are you trying to use? Can you login to mysql via the command line with the username/password in your config file?

    mysql -u yourUser -p
    

    then press enter and type in your password

1 Answer

Hey there,

For the most part, you would want bind-address = to either be the default 127.0.0.1or 0.0.0.0. By only listening on the public address, the web software database connections that look for localhost or 127.0.0.1 would not be able to connect.

Happy coding,

Jon Schwenn
Platform Support Specialist
DigitalOcean

Have another answer? Share your knowledge.