How can I allow my mysqld for remote connection ?

#1
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

1628959759478.png

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

But when I use this.



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=
 

yorich

New Member
#3
exposing your database to the internet is a terrible idea. If you're trying to access it local, you should be using a socket. If you absolutely need to make it truly remotely accessible, then turn on mysql SSL encryption, and make sure you firewall 3306 to only allow from your source IP.
 
Top