Jump to content


Setup for User Connect at non-root level

  • Please log in to reply
1 reply to this topic

#1 Conjurer

  • Members
  • PipPipPip
  • Advanced Member
  • 107 posts

Posted 20 October 2003 - 03:57 AM

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.


#2 Derek

  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationTennessee

Posted 20 October 2003 - 04:09 AM

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.
function comment(s)


	if (i_know_what_to_do_shut_up_i_dont_need_your_help_mode) {
   return  	} else {    return s  	}  }
ext/skeleton/create_stubs, lines 40-47. - PHP Core

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users