Connecting to remote MySQL Database via 3g 4g problem
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Connecting to remote MySQL Database via 3g 4g problem
Evening all
I am in the initial stages of building an app. This app sends SQL queries to a remote MySQL database. When the app is used on the desktop with a wifi connection, or when the app is used on an iOS device with a wifi connection the MySQL query is sent to the database successfully.
When i turn off the wifi on my iPhone and then simply use a 3g or 4g connection the MySQL query will not complete. Has anyone got any input as to why this may be?
As a note the 3g / 4g connection that i am using is good and the amount of data being sent via the connection is very small so i don't think this is occurring due to signal issues.
Many Thanks
I am in the initial stages of building an app. This app sends SQL queries to a remote MySQL database. When the app is used on the desktop with a wifi connection, or when the app is used on an iOS device with a wifi connection the MySQL query is sent to the database successfully.
When i turn off the wifi on my iPhone and then simply use a 3g or 4g connection the MySQL query will not complete. Has anyone got any input as to why this may be?
As a note the 3g / 4g connection that i am using is good and the amount of data being sent via the connection is very small so i don't think this is occurring due to signal issues.
Many Thanks
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: Connecting to remote MySQL Database via 3g 4g problem
First guess in troubleshooting this sort of thing is that your database is probably not set to allow connections from IP address outside of wherever your wifi connection is. Your 3g/4g connection is going to have a completely different IP address.
Quick solution would be to set your database to accept any incoming connections, but this is very terrible in practice for any sort of practical application.
A better solution would be to have an intermediate between your database and app. PHP or LiveCode Server works great, and you can customize your connection and pre-write all of your database queries (basically make your own API to connect to)
Quick solution would be to set your database to accept any incoming connections, but this is very terrible in practice for any sort of practical application.
A better solution would be to have an intermediate between your database and app. PHP or LiveCode Server works great, and you can customize your connection and pre-write all of your database queries (basically make your own API to connect to)
Re: Connecting to remote MySQL Database via 3g 4g problem
Thank you very much
This was the issue, I had set access to the server for only a small range of Its. I have added a wildcard username to allow access from any IP and that has solved the problem.
Many Thanks
This was the issue, I had set access to the server for only a small range of Its. I have added a wildcard username to allow access from any IP and that has solved the problem.
Many Thanks
Re: Connecting to remote MySQL Database via 3g 4g problem
This will have solved your immediate problem but it will introduce another problem in terms of security. Having wildcard access for any device in the world is a very "BAD THING". Much better to build an api to handle posted data for the server to deal with the database interactions. There is another current thread discussing this here viewtopic.php?f=7&t=32028
Re: Connecting to remote MySQL Database via 3g 4g problem
If I open up a cmd shell and run
>mysql --host=12.34.56.78 --port=1234 --user=myuser --password=mypassword mydb
I can successfully connect to the remote mysql database.
But if I create a php page on my localhost containing
<?php
$hostname = "12.34.56.78:1234";
$username = "myuser";
$password = "mypassword";
$dbname = "mydb";
$connect = mysql_connect($hostname,$username,$password) or die ("Error: could not connect to database");
?>
I get the following error:
Error: could not connect to database
Can anyone explain what might be causing the problem here?
mysql_error() => mysqlnd cannot connect to MySQL 4.1+ using old authentication
>mysql --host=12.34.56.78 --port=1234 --user=myuser --password=mypassword mydb
I can successfully connect to the remote mysql database.
But if I create a php page on my localhost containing
<?php
$hostname = "12.34.56.78:1234";
$username = "myuser";
$password = "mypassword";
$dbname = "mydb";
$connect = mysql_connect($hostname,$username,$password) or die ("Error: could not connect to database");
?>
I get the following error:
Error: could not connect to database
Can anyone explain what might be causing the problem here?
mysql_error() => mysqlnd cannot connect to MySQL 4.1+ using old authentication
Last edited by aber10 on Sun Mar 17, 2019 4:07 pm, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 9833
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Connecting to remote MySQL Database via 3g 4g problem
Where does LiveCode fit into this?aber10 wrote: ↑Tue Mar 12, 2019 11:54 amIf I open up a cmd shell and run
>mysql --host=12.34.56.78 --port=1234 --user=myuser --password=mypassword mydb
I can successfully connect to the remote mysql database.
But if I create a php page on my localhost containing
<?php
$hostname = "12.34.56.78:1234";
$username = "myuser";
$password = "mypassword";
$dbname = "mydb";
$connect = mysql_connect($hostname,$username,$password) or die ("Error: could not connect to database");
?>
I get the following error:
Error: could not connect to database
Can anyone explain what might be causing the problem here?
mysql_error() => mysqlnd cannot connect to MySQL 4.1+ using old authentication
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn