firstly, i know it's not that safe to connect to a remote database from a local machine using phpMyAdmin but it came up recently in a discussion i had.
i wrote a brief blog displaying the bare minimum code to enable a connection. i wonder if any of you could have a look at it and post back on your thoughts as to its security and any thoughts on making it better, more secure etc thx.
Also the phpMyAdmin setup isn't really the place to secure it. That is far better done by creating the right grant privileges for the user on the MySQL database in the first place.
E.g.
Grant SELECT on Adatabase.* to 'ro-user'@'111.111.111.111' identified by 'passwd here';
The main security problem with remote connections is using '%' instead of a machine name or IP (or preferably just 'localhost'), which allows anyone on the internet to try and log in. [not that they can, unless they've managed to get your 20 digit fully alphanumeric+higher chars pass].
Personally I bypass all that by using persistent SSH tunnels to forward the MySQL ports on my servers to ports on my local machine.
hmm, good answer.
ok but what, say for example, if you've written a control panel for staff to log in and add info through a 'friendly' user interface (not unlike this) from any location? i think they wouldn't be able to. i think the "20 digit fully alphanumeric+higher chars pass" is the safest way.. but staff never seem to remember those kind of passwords
If they really do need to login from any location then there isn't really any way round using % as a host, although that would suggest that it would be better to look at the system as a whole and possibly create some sort of server-side API to modify they DB entries in a controlled fashion; that the clients could then connect to over SSL etc.
Also the passwords the staff use to login needn't (shouldn't) be the same as the one used to connect to the DB, otherwise they can just install their own copy of phpMyAdmin (or the Mysql client etc) and do what they want with the DB.
i see. i thought u meant use that kind of password for staff logins. no, i would never allow the staff logins to be the same as for the db itself.
defining the requirements for a 'controlled fashion' can be an endless and complicated task. personally i would prefer to develop ip controlled logins but it always comes down to what the client wants.
i think though that developing some sort of class/object to plug into future projects is something i'll start getting on with. that way one can define clearly quite early on to their client what they are and arnt going to get.