Score:0

Connecting to a database which is on another server for laravel application

ca flag

I am trying to connect a database which is on an openlitespeed digital ocean droplet. Now I have created a new database using phpmyadmin. And I want to use this database for my laravel app which I deployed using there Apps platfrom.

The issue is in connection to the database. On table plus when I use the following credentials

enter image description here

server has the IP address of my openlitespeed server. This works.

But when I use this.

enter image description here

Again the Host has my Openlitspeed server ID it says 'Can't connect to the MYSQL server on 'my-ip'(10060)

This command netstat -tlnp returns

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      23749/mysqld
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      1004/redis-server 1
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3491/openlitespeed
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      18201/systemd-resol
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      13183/sshd
tcp        0      0 0.0.0.0:8088            0.0.0.0:*               LISTEN      3491/openlitespeed
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      1321/master
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      3491/openlitespeed
tcp        0      0 0.0.0.0:7080            0.0.0.0:*               LISTEN      3491/openlitespeed
tcp6       0      0 ::1:6379                :::*                    LISTEN      1004/redis-server 1
tcp6       0      0 :::22                   :::*                    LISTEN      13183/sshd
tcp6       0      0 :::25                   :::*                    LISTEN      1321/master

I need the 2nd method to work so that I can set following environment variable.

DB_CONNECTION=mysql
DB_HOST=
DB_PORT=
DB_DATABASE=project-qualification
DB_USERNAME=
DB_PASSWORD=
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.