Cant connect my website to a database on a VPS - php

Well i got a free host to run my website, i uploaded all the files:
The point is: my website requires to read/write accounts from a database, located on my VPS (Windows Server).
My website connects through:
Where abboud_auth and abboud_world are my databases, IP is my VPS' IP and user and password are my user and password of my navicat, which is also running on my VPS.
So, now on my VPS, i have my databases:
So, the problem is that when i run my website i cant connect to my databases.
I'm using Xampp, and its mysql config is:
In fact, i tested the remote access with this web, and i cant connect:
The obvious question: what should i do?
Thanks ^^

Related

How do I connect my website on a external server to my database run off of Xaamp on my local host machine?

I have been building a website for a project using XAMPP. It has a database for users to register which stores their details. I was going to test my website with my friends by physically giving them my laptop however due to coronavirus I can no longer do so. As a result, I have had to upload my website to my university server for people to access the URL, however how can I reconnect this with my database that is on my XAMPP?
The code that I'm not sure how to alter is here and this is in a php file on my uni server (this may not even be the correct code to alter):
$db = #mysqli_connect('localhost','root','','databasetable') or die ("Could not connect to server");
OR
Is there a way for people to access my XAMPP files on my machine remotely for my friends to test the website and be able to make a log in etc.
Thanks in advance :D
You can expose your localhost databases by using tools such as http://ngrok.io/.
The command ngrok tcp 3306 will create a secure tunnel that can be used in your code.

Connect to database in wampserver from another pc in LAN

I have setup svn server. The project files can be shared. But i would like to keep all the database in server pc and share those database with other pc in LAN. I have gone through various forums and still didnt get my solution.
Phpmyadmin can be accessed using ip address. But when try to connect to the database from server pc it says Host "user-pc" is not allowed to connect to this Mysql server.
I would really appreciate if any one could help me out.

Access denied for user 'username'#'localhost'

I am currently programming a launcher in Visual Studio that gets the version history from a MySQL server. I have run into an issue where I cannot connect to the database if I use a public login for the database. If I use the root login I can connect on my local machine but no other. This is what I am using with subins to protect my data:
"server='serverip';user='severusername';password='serverpassword';database'databasename'"
If I use the root password, it will connect on my local computer. If I use my godaddy hosting database, it will also work on any computer. The MySQL server I am connecting to is on my local computer and running WAMP. Does anyone know a way to get it to work? My user has full permissions. This is programmed in Visual Studio using Visual Basic.
It appears that you have a typo:
database'databasename'
Should that not be:
database='databasename'
Also, it could be that godaddy does not allow remote connections for MySQL so when you try to connect from your local WAMP installation to their remote MySQL server the connection is denied. This is more than likely the case as the bandwidth cost for this can become quite huge very quickly. You should however be able to run things in the shared hosting environment using localhost as the server/hostname.
I fixed it by adding 2 cases of my user. One with a host of localhost and another with a host of 127.0.0.1

Connect to SQL server from localhost

I have a newly set up LAMP system for testing a website I am developing. School has supplied a database that uses a phpmyadmin webinterface. If I host the website on the domain I have been assigned by school, everything works fine, but if I host the same files locally it get the following error:
SQLSTATE[HY000] [2002] Connection timed out
Having read up as much as I could, I suppose some setting restricts my access to an external database when hosting locally, but I am lost as to how to fix this.
I know of the my.cnf file but the skip-networking, and bind-address options were already commented out. Also, I checked that both httpd and mysqld are running.
Odds are very good that the school's database doesn't allow connections from remote IP addresses. Has your instructor specifically told you that you should be able to connect?
To fix it, you'd have to have the system administrator open it up for you.
When you say you edited my.cnf, on what machine did you make those changes? Your local LAMP system or on the school's database server (or convince them to give you VPN access).

How can I connect to MySQL database on a dedicated Windows 2003 server from EC2 based app server with PHP

I have developed a web application that uses PHP and MySQL and has all been running fine from a single development server. I now want to separate things a bit and place an app server within Amazons cloud that will receive and process uploaded files. The database is going to remain on the dedicated server but will need to be accessed by the EC2 instance.
Heres what I have tried so far...
In phpMyAdmin I added a new user to the privileges table. I gave it the elastic IP address from AWS as the host name, a new password and granted privileges to INSERT, SELECT and UPDATE.
In the PHP scripts on my EC2 based app server I included this username, password and the domain name of the location of the mysql server (example.domain.net) when connecting with mysql_connect
I have a simple test page that tries to SELECT and echo some results from the database but get the following error -
Could not connect to MySQL: Can't connect to MySQL server on 'example.domain.net' (4)
What could this mean, what have I missed, are there any other issues such as trying to do this from within EC2 that will cause other problems?
cheers all
Turns out the only other thing I needed to do was to open port 3306 on the database server to allow access. Did this by going to Control Panel -> Windows Firewall -> Exceptions -> Add Port ["SQL", 3306]
Now it works great!

Categories