0

I am currently working on a localhost database and I am moving everything online so I am looking for a reliable database where it can be used where ever I host my website. So I was looking into cloud databases and everything looks pretty expensive from what I am looking for except of SQL Azure.

RDS comes to 75 dollars per month the smallest instance, Xeround comes to a limit of 20 connections for the basic database and the next goes up to 75 dollars. So it is not that reliable.

I decided to move to SQL Azure because of the 3 months free so I could try them out but I figured out they do not support by default MySQL (? Correct me if I'm wrong). I am a total beginner in database and such so I just know all the basic stuff.

So I was wondering, if I want to select all the users in my database, with MySQL I do this:

$query = mysql_query("SELECT * FROM `users` WHERE id = '$uid'") or die(mysql_error());
$result = mysql_fetch_array($query);

Is it different with SQL Azure? Do I have to learn something completely new? I found many articles and tutorials on how to migrate from one another but none tutorials actually say if and how to change my php code of which connects with my database.

If there is any other service of hosting MySQL on the cloud please let me know

1
  • 1
    I believe the Amazon cloud (EC2) only supports mySql and is comparatively inexpensive. Commented Mar 7, 2012 at 19:47

2 Answers 2

4

MySQL and SQL Azure are different enough that you will need to change some/most of your queries, but not by much if your queries are simple enough. I am by no means a PHP/MySQL developer, but the SQL code you are presenting is close to working in SQL Azure.

Take a look at this article that explains how to connect to a SQL Server database (note: there are differences between SQL Server and SQL Azure, but I would start there first - at the risk of over simplifying things, think of SQL Azure as a subset of SQL Server). Here is another link that shows how to connect to SQL Azure using PHP specifically.

So to answer your question, I would say that you certainly would have to learn new things if you were to go this route. But learning is fun! :) Perhaps one of the things to understand about SQL Azure is its architecture and throttling behavior. First, take a look at this TechNet article that explains how SQL Azure works.

Here is a more technical article about SQL Azure that goes into throttling and performance considerations if you think your database is being heavily utilized. I highly recommend you absorb this before jumping both feet in SQL Azure. It will save you some time later.

Hope this helps.

Sign up to request clarification or add additional context in comments.

2 Comments

Okay if thats the case, if I install mysql and phpmyadmin on my server, how can I serve it on different domains? the server that shows up on my own server, is localhost instead of an ip that I could use with any server. Does that make sense?
I don't know enough about MySQL to answer your question in detail, but you should be able to bind your MySQL service to the actual IP address of your server. In fact that might be done by default. Just try connecting using the IP Address of the server.
1

Azure now supports MySQL as an option.

1 Comment

Let me tell you, Azure Mysql is not native at the moment, so .. they provide by a other entity CleanDb Mysql databases, which are expensive per Gb, and limited. You will pay 75$ for a dedicated solution because the others did not support triggers or views! And that is not on their pricing Details. Off course i quit. But the important thing is Amazon is very Cheap And has RDS MYSQL. Notice you should have your API or PHP code call your DB from the same server or very close, otherwise latency will be a issue!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.