Can you hide tables from a MySQL user in phpMyAdmin? - mysql

I have a MySQL user added to a database that I would like to prevent from viewing certain tables.
I can limit their privileges through MySQL by preventing them from running statements like DROP or ALTER. But is it possible to prevent them from viewing certain tables in phpMyAdmin?
If there isn't a MySQL privilege that controls this (I wouldn't imagine there would be), is there a configuration in phpMyAdmin that allows this?
I understand one workaround here is to move the tables to a new database that they're not added to. This isn't an option for my application.

Yes, you can hide a particular database in phpmyadmin.
In order to do that, just open config.inc.php in your phpmyadmin directory in your webserver root or where it is placed. or search for config.inc.php
if you want to hide information_schema and mysql add this line after:
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['hide_db'] = '^information_schema|mysql$';
This is It.

You could move the tables to another database and then restrict the user account to only access the 1 database with the public tables. Trying to modify phpmyadmin would be a massive mistake, the user could just write a custom query to access the tables, thats a dead simple hack.
This has to be done on the database side or there is absolutely no point. SE-Postgresql is the only project i know of that allows for table by table permissions. This is the only database that can do this because very few people need this feature.

phpMyAdmin connects to the database as a certain MySQL user. If that user does not have any permissions on the given tables no phpMyAdmin user can access that. That would hold for all mypMyAdmin users of course.

Related

PHPMYADMIN - How do allow a user to create a database, but only show the db's created by that user?

Question says it all, but to clarify:
I can only create a database when the create is set - this is obvious, however as soon as I do all the databases show up in the left column.
As soon as I remove the remove this option to create it only shows the DB that the user has access to controlled by the root user.
I want a user to be able to create a database, but not see all the db's that are created
In Terminal I can create them, but I want to use phpmyadmin so that not everyone needs to use the terminal interface.
Thanks.
You can use a trcik to it. You can allow your users to create database which start by a specific name lets say testdatabase. And then you can set the previleges like this
GRANT ALL PRIVILEGES ON `testdatabase\_%` . * TO 'testuser'#'%';
So this will allow the testuser to have access to all the database which are having the name like testdatabase_

MySQL Privileges To Create Database

Is there a way to create a user in MySQL that have login access but no databases, but it allows the user to create a new database to a limit of 5 or what ever I decide.
So basically what I want is to give a user access to create his own databases, but I dont want him to see other databases, also he should be limited to create only 5 databases
There is no notion of "Database Owner" or "Database Creator" in MySQL, therefore there is no way to limit the number of databases created by a user.
Note: it is possible to put some restrictions at account-level, but not the ones you are looking for. You will need a third-party management tool for this.

Hide database from user while allowing user to query it

I was hoping someone could help me with a mySQL / phpMyAdmin problem. (I don't even know if it is possible...)
Here is the problem:
I have 2 databases: DB1 and DB2
I have a user DB1user. This user has full access to DB1 and has select access to specific tables in DB2.
I was hoping that there was a way to hide DB2 from the user. I.e. when user types in 'SHOW DATABASES;', I would like that user to see only DB1. However, when user types in 'SELECT * FROM DB2.TABLE1;', he should see results of his query.
Is this possible? Doable?
Thanks for the help!
These two queries will restrict a user to a single database, so that the user can only see, update, and delete tables from that single database:
Replace USER with the MySQL username
Replace USERDATABASE with the single MySQL database you wish the user to have access to.
REVOKE ALL PRIVILEGES,GRANT OPTION from USER;
GRANT ALL ON USERDATABASE.* TO 'USER';
Did you try using the Privileges page in phpMyAdmin where you can create users and restrict their access to specific databases as well as operations?

SQL Server : set user to only SEE 1 database, and only some views. (not just deny access, so they can't see at all)

I'm trying to set up a user in SQL Server 2008 R2 so when they login, they only see one database and so they only see views with 1 schema.
They should not be able to see that other databases exist, that any tables exist within the database that they can see, or any views that exist other than tables that belong to one schema.
How can I go about doing this?
Thank you in advance
Edit: some more information. I have managed to get a user to only see 1 database and no others in the past by denying view all databases and making the user the owner of the database. In this case the user can not be the owner of the database.
You can move the database to a new instance.

MySQL database - backup problem

Hi I need to backup MySQL database and then deploy it on another MySQL server.
The problem is, I need it backup without data , just script which creates database, tables, procedures, users, resets autoincrements etc. ...
I tried MySQL administrator tool (Windows) and UNchecked "complete inserts check box", but it still created it ...
Thanks in advance
use mysqldump with option -d or --no-data
don't forget option -R to get the procedures
this page could help you: http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html
From within phpMyAdmin you can export the structure, with or without the data. The only thing I'm not sure of, is wether it exports users as well. If you like, I can test that tomorrow morning. It exports users too. You can check all sorts of options.
(source: obviousmatter.com)
According to the page, there isn't a good way to dump the routines and have them easily able to be recreated.
What they suggest is to dump the mysql.proc table directly. Including all the data.
Then use your myback.sql to restore the structure. Then restore the mysql.proc table with all of its data.
"... If you require routines to be re-created with their original timestamp attributes, do not use --routines. Instead, dump and reload the contents of the mysql.proc table directly, using a MySQL account that has appropriate privileges for the mysql database. ..."