Jump to content

PHP MySQL database connection


pradeep79

Recommended Posts

Hi all, I'm involved in a project where I have to create a web application with PHP and MySQL. My question is, usually we use one user name and password to connect to the database for the whole application, in which case all the users will connect to the database with that username we set in PHP script. If we want to have different users with various access rights on the database this strategy will not work, because we give one username and give maximum access rights for that username. Is there any way where you can define the access rights of a user in the database(MySQL) and use the same username and password when the user connects to database through PHP application? If so, we will have hundreds of users connecting through the PHP application with different usernames and password, will this have any impact on the web server or DB server? Is it secure? Is there any other way this can be done?

Link to comment
https://forums.phpfreaks.com/topic/44704-php-mysql-database-connection/
Share on other sites

It can be done, you would just need to use a main user/pass to create the initial db connection, gather the username/pass combination than close theat connection and create a new connection using that information.

 

As far as this being looked down upon or insecure I am not sure. But yes it is possible.

Archived

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

×
×
  • 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.