PHP general thought about database
Generally we use that database which is added without domain. For example you have domain calledexample.com
then obtusely you will use that database or Myphpadmin. But is it possiblesuppose
I haveexample.com
domain and I want save any data which use fill from other website calledabcd.com
show inexample.com
How it would$conn
structure?
Answer
Solution:
It's quite common that databases have another domain, i.e.
mysql.example.com
. This scenario can often be seen at hosting-companies.Nevertheless it's a security-aspect to allow access only on
localhost
, then phpMyAdmin needs to be installed exactly on that server where the site is running, and when it's disabled or just not installed, then no access is possible.So your scenario is nothing special.
Edit:
If your database is running without domain (not even
localhost
) then the connection is by socket. This is common on servers when nothing else is configured. Technically it's still a bit different, if it's configuredlocalhost
then a socket-connection is established, if you call the local IP-address 127.0.0.1 then a TCP-connection (like for a website). Nevertheless, both solutions can be seen as secure while the socket-connection requires another configuration for phpmyadmin.