Question

from the root user I have added a user under that user one database but when I login with that user I can view all database. how can one user view only its own database assigned to it

Was it helpful?

Solution

/phpmyadmin/config.inc.php with your favourite editor and fill in the blowfish_secret line.

e.g.

$cfg['blowfish_secret'] = 'UltraSecretPassphrase';

Access via http:///phpmyadmin/ and login with the MySQL root username and password.

Click on the SQL tab in the righthand pane and in the textbox labeled Run SQL query/queries on server “localhost” paste the following SQL statements and change pmapassword to something more secure., then click the Go button.

CREATE USER 'pma'@'localhost' IDENTIFIED BY 'pmapassword';

 GRANT USAGE ON mysql.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapassword';

GRANT SELECT (Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv) ON mysql.user TO 'pma'@'localhost';
 GRANT SELECT ON mysql.db TO 'pma'@'localhost';
 GRANT SELECT ON mysql.host TO 'pma'@'localhost';
 GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv) ON mysql.tables_priv TO 'pma'@'localhost';

 GRANT SELECT (Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
 Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv) ON mysql.user TO 'pma'@'localhost';

 GRANT SELECT ON mysql.db TO 'pma'@'localhost';

  GRANT SELECT ON mysql.host TO 'pma'@'localhost';

   GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv) ON mysql.tables_priv TO 'pma'@'localhost';

Now we need to modify the configuration of phpMyAdmin to support multiple unique users. Once again edit /usr/share/phpmyadmin/config.inc.php with your favourite editor and complete the following changes.

Remove the // in front of these 2 lines and fill in the password chosen above

$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'pmapassword';

Add the following line after the lines above

 $cfg['Servers'][$i]['hide_db'] = 'information_schema';

Add the following line before the end ?>

 $cfg['AllowUserDropDatabase'] = true;

Change the Server extension line from mysql to mysqli

 $cfg['Servers'][$i]['extension'] = 'mysqli';
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top