Mysql workbench shows wrong database instances - php

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.

Related

Issues setting up mysql database

I have a php script that (in theory) connects to a database. The issue is that when I try to test my script in http://phptester.net/ it tells me that said credentials are wrong.
I am fairly new to this whole php and mysql set up but this is what I know thus far:
I have a domain registered # godaddy.com with hosting (obviously)
I used their Database Interface to create my first database (I called it myProfile)
I also used their interface to create a user and added that user to the database with all its privileges
Here is where the issue lays:
I go to Databases link in my cPanel page and see my database WITH my user and you can see its privileges:
Now, I go to phpMyAdmin in godaddy and I find that there is indeed the myProfile database but I can't find the user I created.
I see a user that I never ever seen before but no matter what I do in phpMyAdmin I can't ADD, CREATE, GRANT PRIVILEGES or do anything user related. I even tried looking up in a query to see if the one I created on the interface shows up. But nothing works!
Can anyone help me with this conundrum?
Your host likely doesn't accept incoming connections from anywhere but 127.0.0.1. Even if it does, it shouldn't accept those requests unless they're encrypted.
Therefore, PHPTester.net fails - not by any deficiency, just because Godaddy is using default/recommended/smart security settings to disallow these remote connection attempts.
Why not try testing the database connection by opening a browser window pointed at the connection page you're showing us?
I dont really get lucas's answer but after creating a user you have to explicitely assign the user to the database.

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.

mySQL Database. Own Website finds it, external programs not?

so I'm creating a website right now where I have a mySQL Database included and I'm displaying some tables of it on my website (with PHP) and it works fine.
But now I'm trying to access the database in another program (Unity) to edit my database.I get the error that the host name wasn't found. Then I tried to ping the ip (given from my hoster 1&1) via the Windows console, but not found. mySQL Workbench doesn't find it either.
I'm wondering if I have to set the database to public or something like that when I want to access it from another program. My Website can access it, probably because it's hosted on the same account.
But I only got a hostname, username, password and database name. The hostname is something like that: "db123456789.db.1and1.com". My domain is of course not this. Do I have to change the host name? On my php website script I used this host name and it works fine.
I'm kind of confused how this works and I can't find any option where I could say like "Hey DB, show yourself to the public".
Any tips? Searched the World Wide Web, but didn't found a hint. Thank you.

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.

Problems connecting to a remote server and performing a simple db query

I have set up a website with basic HTML/CSS files and would like to take that one step further and implement a database with some PHP to perform simple queries and whatnot.
My problem arose when I noticed while setting up the database and creating the PHP files that connect to the database (on my local machine), I used 'localhost' as an argument for mysql_connect. When I then went to drag and drop my newly created HTML/PHP files along with my database into FileZilla to upload the pages onto my remote server, there was a problem connecting to the database. I have a feeling that it is unhappy with the whole 'localhost' notion - yet I don't know what to change it to.
Currently, I am using this line of PHP code to connect to my remote database (which is all located in FileZilla-land).
$link = mysql_connect('localhost','Tommy','pass')
Also, as another quick question: does my remote server have its own phpMyAdmin page? And if so... how would one go about finding it? =D
I appreciate anyone who is able to assist me in my endeavors.
Thank you!!
Log on to your database server, check the details and obtain the correct server information such as server, username and password.
Once you change the server details you shoudl be ready to rock n roll. Edit post with the host name/server name and we may be able to find it for you.
You'll have a phpMyAdmin page where you're hosting the site. Check the membership area or cPanel.
You are right in that 'localhost' in mysql_connect needs to be different. 'localhost' is a textual representation of a loopback address AFAIK - it connects to the computer it is hosted on. As you have uploaded it to your server (a different computer) it is now trying to connect to a mysql server on the server host, instead of your home computer (which holds all the data).
To make this work you'd need to get your database onto the server you are now working from, OR depending on your home setup, point it to your local database.
Whether your host has MySQL/PHPMyAdmin available to you is another matter altogether. If they have MySQL it is probable but not definite that they have a phpmyadmin interface.
Contacting the server host will yield more information. If they have MySQL, it is probably as simple as getting the required details from them, and 'backing up' your SQL on your local server and uploading it to the new server (easily done with PHPMyAdmin)
TL;DR: The database you are trying to connect to doesn't exist on the server you're connecting from.

Categories