Reputation: 7424
I have, let's say, a root website with mysql db on a remote server.
I want to connect to that particular database (to make queries), from many other little websites (with lower priviledges).
Can this be done?
Language: jsp, java, php
Upvotes: 1
Views: 599
Reputation: 570615
Yes it can be done, MySQL allows connections from remote hosts (assuming MySQL is configured to allow network connections and assuming the remote hosts are granted). In case of problem, the section 5.4.7. Causes of Access-Denied Errors lists most common problems and solutions.
Upvotes: 2
Reputation: 198526
If the MySQL server is under your control, it's not difficult; you can find the procedure here. If it's not, the only thing you can do is beg the admin to do it, otherwise it's impossible.
Upvotes: 0
Reputation: 368609
The default configuration often contains a variable
skip-networking
which you need to comment-out in order to have networking enabled.
Upvotes: 2
Reputation: 1608
In addition to the answers from Nikita Rybak andPascal Thivent, I'd like to note that most hosting providers don't allow queries from locations other than localhost.
I don't know how much access you have to the server configuration, but I would have saved myself a headache a while back when I first started experimenting with connections across domains/servers.
Upvotes: 0
Reputation: 68046
Any particular problem? Just specify server address instead of 'localhost' in connection string.
You can also create dedicated user with minimal privileges for that.
Upvotes: 2