Jump to content

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

Link to comment
https://forums.phpfreaks.com/topic/1190-setup-for-user-connect-at-non-root-level/
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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.