Jump to content

Archived

This topic is now archived and is closed to further replies.

Conjurer

Setup for User Connect at non-root level

Recommended Posts

This is definitly a newbie question, but you gotta start somewhere.

 

I have worked with a lot of SQL all the way back to Rbase so I am not new to the database design and know the syntax. Problem is I have always been the sole user of those databases and have never had to deal with someone else connecting to it.

 

I am working through the PHP Freak\'s Membership tutorial. In the db.php file that you include you set up the variables to run the connection to the data base. I set my initial trial up using the following:

$dbhost = \'localhost\';

$dbusername = \'root\';

$dbpasswd = \'xyz213\';

$database_name = \'freaksmembers\';

 

 

So my question is when I end up setting this up on a real website how should I change this so they don\'t log into the root?

 

Assuming the website is at www.mydomain.com do I just set up a generic user for connecting ike \"Webentry\" assign a password like abc123 and then change the db.php include variables to:

$dbhost = \'www.mydomain.com \';

$dbusername = \'Webentry\';

$dbpasswd = \'abc123\';

$database_name = \'freaksmembers\';

 

Would appreciate any suggestions that will help me take this over to the my webhost\'s site. I am especially concerned that I don\'t set myself up for a security problem.

 

Thanks

Share this post


Link to post
Share on other sites

MySQL uses what are called \"GRANT TABLES\" for username/password information. Grant Tables are actually a table in a mysql database, and you\'ll have to maintain that. If I remember correctly the syntax is:

 

GRANT * ON databasename FOR \'username\'@\'host they connect from\' IDENTIFIED BY \'password\'

 

you can of course allow the user to connect from any host by using \'username\'@* and such. and instead of GRANT * you can use GRANT SELECT,UPDATE,INSERT etc. Hope this helps; if that isnt the right syntax atleast you know what to search for.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.