HowTo configure phpMyAdmin to show specific databases only for root user - php

I just installed phpMyAdmin 4 on Ubuntu 14.04 with access for multiple users.
This works fine but I am wondering how to hide specific databases for all users except root.
For all users I edited /etc/phpmyadmin/config.inc.php:
$cfg['Servers'][$i]['hide_db'] = '^(information_schema|mysql)$';
And how to configure phpMyAdmin to show this databases only for root?

Instead of hiding the database, I would recommend removing their access via the Users menu. Typically you should only allow users access to the tables they need access to; hiding a database would not prevent them from dropping a hidden table or even changing the root password via a SQL statement if they still have access to the users table.

Related

Stored procedures are getting vanished in mysql after relogin to phpmyadmin

I have created MySQL database using cpanel and created required tables, stored procedures in it from phpmyadmin.
After creating, at the end as usual I logged out from both cpanel and phpmyadmin too.
Next day I logged in to cPanel and then opened phpmyadmin, what I found is list of all the stored procedures is there; but there definitions is not there. And even "Edit" & "Execute" options were also disabled.
I am using VPS from well known hosting company.
I have never faced this type of problem from any other hosting company.
I also given proper privileges to database user. But still not able sort out this problem.
Is it something my fault or is it some sort of setting which we have to set from WHM panel or cPanel?
Thanks in advance.
After some R&D, I found that whatever users are being created through cPanel, they don't have super privileges. And hence they can create stored procedures but once they log out they wont be able to edit them. This is what by default settings done by hosting company.

phpBB and mySQL "Could not connect to the database..."

I am trying to set up a phpBB forum on a locally hosted webpage. It being done in an openSUSE Linux OS.
I have installed MariaDB (MySQL), and created a new database named new_database using the command CREATE DATABASE new_database;, along with a user named user with the command CREATE USER 'new_user'#'localhost' IDENTIFIED BY 'password';. I also changed the root password to password, just for testing purposes.
When I enter this info into the phpBB installation database settings screen, I get the error
Could not connect to the database, see error message below.
Access denied for user 'new_user'#'localhost' to database 'new_database'.
I am using localhost for the DSN. Any ideas? From everything I've found online it should be working...
After you create the user you have to Grant Privileges, this is how you do it.
GRANT ALL PRIVILEGES ON new_database.* TO 'newuser'#'localhost';
Do not forget to flush.
FLUSH PRIVILEGES
Common Privileges
ALL PRIVILEGES- all access
CREATE- allows them to create new tables or databases
DROP- allows them to them to delete tables or databases
DELETE- allows them to delete rows from tables
INSERT- allows them to insert rows into tables
SELECT- allows them to use the Select command to read through databases
UPDATE- allow them to update table rows
GRANT OPTION- allows them to grant or remove other users' privileges
You can specify the database and table.
new_database.* (Specific Database, all tables)
new_database.table (Specific Database, specific table)
*.* (all databases, al tables)
I had the same issue with a phpBB install and solved the problem by accessing the database through phpMyAdmin and noticing on the splash page it said "User: pits#localhost", which was different from the user (pits_bull) I had created and attached to the database and was trying to connect with.
I tried it with just "pits" and it worked. Not sure whether there is a security issue with that though, or why it worked, but it IS working!

phpMyAdmin and mysql not showing the same database

I have setup WAMP which I managed by using a tutorial and everything seems fine... I am logging into mysql as the root user with full privileges granted and I am able to create databases in mysql and view them by using SHOW DATABASES; so far so good !
...However...
When I access phpMyAdmin and go to the databases section, there are no databases which I have created in mysql, even though phpMyAdmin shows the Database server as User:root#localhost which is the same user I am accessing mysql with.
This situation is also the same when reversed, I can create a database as the root user in phpMyAdmin but the database will not show in mysql when I am logged in as root user and use SHOW DATABASES;
i have tried every soution available ONLINE ..
most of them saying about
$cfg['Servers'][$i]['hide_db'] = '';
i have done that too ....
but nothing seems to work....
plzzzz help

MySQL not showing databases created in phpMyAdmin

I'm trying to build a database for my server in phpmyadmin but when I finish building it I can't access it using PHP and it won't show when I list the databases in MySQL. But when I create a database in mySql it shows up in phpmyadmin. Also I'm running phpmyadmin version 4.0.3, and theres a statement at the bottom of the page saying The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. To find out why click here.
Thanks!
I just had the problem, and realized that I was creating database with names with '_test' suffixes.
It happens that phpmyadmin has a feature to hide some DBs. To change that behaviour, you can navigate to : settings > features > general > Hide databases
By default, hiddent databases have these patterns : information_schema|mysql|performance_schema|test|phpmyadmin
If you Still don't see it, Try to logout and then log in again to cPanel or PHPMyAdmin. It worked for me.
This sounds like a permissions issue. I'd guess that your phpMyAdmin is connecting to MySQL as root (or another user with the superuser privilege) and can therefore see all databases. Your app is probably connected using a different, lower privileged user.
Try running select user(); from your app and from phpMyAdmin and you will know for sure.
Assuming your app is running with a different user, you will need to add privilages for it to access the database you create. Please read the section titled Assigning privileges to user for a specific database in the phpMyAdmin documentation.
This is pure permission issue.
If you logged in without specifying the user, you won't see all the databases just like #t3po7re5 mentioned. What you should do is specify root user in your command.
mysql -uroot -p
It will prompt you to then enter the password. this is the default password if you have not specified or changed the default root password depending on the local server you are using.

Mysql workbench shows wrong database instances

In order to create a new database i use Plesk Panel.
I am also using mysql workbench to administer my database instances.
The problem is that when i connect to a database in my server (via workbench) using its unique credentials (database user and passwd) i'm able to see another database instace as well that i have created for another domain in my server via plesk panel.
This second database instance has different credentials from the ones i used to login to the initial database and therefore shouldn't be visible at all.
Does anyone has a clue of how this can happen?
Both are likely linked to your account. I've used a shared hosting environment (Plesk) before where I could see all the database names on the entire server but without the correct credentials I wasn't able to access any of them or view their table structure (I found out because I didn't want others accessing my database).
I would check with your web host for more information.
You don't connect to a database, but you connect to a server. The user you are connecting with has been given privileges to access db objects according to the domain it belongs to. However, if the user you connected with is allowed to enumerate schemas then you will be able to see all defined schemas (= databases) on this server. That doesn't mean you can access it. No reason to worry unless you don't want users to see schemas they have no rights for.
Use the Server Administration section where you can list all users and see what privileges they have for which db object.
First of all thanks a lot for your time and answers.
The reason behind my problem was the actual name of the database instance I had created, which contained the word "test_".
Every database instance created with this text inside its name was visible to every database user when using mysql workbench.
I know it seems a bit strange but I resolved the issue by just changing the name of the db instance.

Categories