Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure phpMyAdmin for multiple users - each with access to their database only

I want to configure phpMyAdmin to be able to accept one of several different user account logins. Each user would be allocated a specific database and only have access to that.

The default configuration with phpMyAdmin is one super user, e.g. root which has access to every database on the server.

I need to be able to give people access to certain database(s) but not all.

Could you either

  1. offer a solution
  2. comment on my findings with the existing solution below which had to be adjusted to properly work

The following solution works - with an additional step (described below): http://alandoyle.com/tutorials/configuring-phpmyadmin-for-multiple-users/

The additional steps are to first assume you've setup a mysql user and password, e.g. 'anotheruser' and associated this user with a database - i.e. added this user to the list of users that can access that database.

The 2nd additional step is to run the SQL query block quoted in the page of the above solution again (after already running it once, as instructed in the original text, pretty much as quoted (obviously making sure the correct password is used)) but this time for the actual user you want to give access. So if your user name is 'anotheruser', then you replace pma with anotheruser and pmapassword with the password for anotheruser.

So together with all the instructions this seems to work. It would appear then that each time a new user is to be added, that same SQL query has to be run for the new user. But the impression I got from the solution was that this was a one off SQL query to support adding any number of users and adding them to databases via the phpmyadmin ui. Thoughts?

Other solutions looked at on SO (but not quite what I need):

  • Is there a tool like phpMyAdmin which can be configured to access just a single database?: Is there a tool like phpMyAdmin which can be configured to access just a single database?
  • how to configure config.inc.php to have a loginform in phpmyadmin: how to configure config.inc.php to have a loginform in phpmyadmin
like image 402
therobyouknow Avatar asked Nov 15 '22 07:11

therobyouknow


1 Answers

use this

  $cfg['Servers'][$i]['auth_type'] = 'cookie';

in place of

  $cfg['Servers'][$i]['auth_type'] = 'config';

in your config.inc.php and restart services then authentication process will start for all users and they can do work according to there grants.

like image 155
Ajay Kadyan Avatar answered Dec 29 '22 00:12

Ajay Kadyan