Issues setting up mysql database - php

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.

Related

Get back the access to the database on local server

I've done a mistake and would be really thankful to get help.
I've been using MAMP to create a wordpress website on my computer. Today I've been trying to move in to the actual hosting and I guess I've somehow damaged the database.
The thing is that the default username and password are "root" and i wanted to change that before downloading database from the local server. I did, and after that i couldn't use phpMyAdmin, it suggested me to check config.inc.php. I went to this file and there in the code there were still default "root" username and password.
I changed them to the new ones (the same i used before) and it helped, but only to a certain extention. Now i can use phpMyAdmin, but don't have the rights neither to create a new database, nor to make any changes to the user privileges.
So the question is: how to make it all working as it was working before? :)) Thanks a lot in advance!
The second little question is:
Are there any possibilities to upload and use this messy database to the actual server? Otherwise none of the settings on my website is working and i kinda have to restart making it.
Since you can't do much from within phpMyAdmin, it sounds like you may be logged in as the anonymous user, which happens if you try to log in and don't match an existing username/host. Double-check that the username and host you're logging in as are the ones configured in MySQL. You may need to reset your account. Even though the error message is different (due to the use of the anonymous user), this may be helpful: Fix Access denied for user 'root'#'localhost' for phpMyAdmin
If your auth_type is 'cookie' or 'http' then you don't need to edit config.inc.php with your new login information (since config.inc.php shouldn't have it in at all, the user and password fields are only used with auth_type 'config'), only enter it when prompted at login.

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.

phpmyadmin install & login headaches

So, I'm adding phpmyadmin to a new server. I don't use it, but my designers do, so this is my first run in with it. I got it up and running without any problems, but I've hit a wall when it comes to logging in to the db.
it works just fine if I set authentication to config, and enter a valid username and password in the config.inc.php file, but as this will be a somewhat open server, I need authentication to be set to cookie. It seems easy enough, but using the exact same user credentials that worked in the config file, every time I try to log in it boots me back to the login screen.
I'm using a mysql db on a remote server, but the user I'm using has the correct access, and I've tested using sequel pro and a bash shell, both connected without any issues.
I can't seem to figure out what's causing this, and I'm not getting any errors back from phppmyadmin.
The server it's on is running php 3.5, and the server it is connecting to is running mysql 5.1, in case that helps.
I understand you are trying to connect to a server different from the one that hosts phpMyAdmin, right?
Looking at the documentation about authentication I see a posible thing to check when using cookie method:
If you want to log in to arbitrary
server see
$cfg['AllowArbitraryServer']
directive.
So, althought it doesn't say so explicity, I understand you need to set that parameter in this case.
When you use "config" authentication type, the user's "username" and "password" are the ones you have chosen in the config file.
When using "cookie" authentication type, phpMyAdmin asks for mysql users, so when logging in to a specific database schema, you should log in in phpMyAdmin with a username/password which has privileges on that db in mysql.
In config.inc.php don't forget to put some random string in $cfg['blowfish_secret'] if you intend to use cookie authentication.

MySql Insert doesn't work when the website deployed on the host!

I'm using XAPP under windows and my website just working well!
when I deployed it on the host server, it seems to be working normally, but the insert requests to MySql doesn't have any effect, nothing is changing on the database!
Does anyone had this issue before? is there any configuration in MySql to make it accept insert requests? or simply whats the best way to make it work!
[EDIT]
I use PhpMyAdmin, I have two tables members and notifications, I wanna configure permissions so I can Insert into the notifications table, any hint please?
thank you
check the permissions on the database server for the username and password that you are using. It can also be restricted by IP address, among others.
Indeed, the administrator can set read-only privileges for a user or for a specific table.
Check out the "grant" command for more information.
it would be helpful if you could find out the error message that MySQL is returning. check your web server log files. if you are using some shared hosting plan, there should be an option in your host control panel to see the web server log files. PHP is configured in most places so that error messages are stored in web server log files. find out what is actually happening there. it could be permissions most likely.

Categories