can't access MySQL database for Drupal - php

I just installed an instance of Drupal on a shared web hosting account earlier today (via softaculous). I set some things different from how I wanted it the first time, so I deleted the directory it installed in, and the database and user that were created for it, and then tried again. Shortly after starting to work with the second install, I got the error described below, and I hadn't done much yet so I re-installed again. Now I'm on my third install, with all three using the same database and user name (I deleted the old MySQL database and user through cPanel before each install), and the same error is happening again.
When I try to access any of the drupal pages, I get this:
PDOException: SQLSTATE[HY000] [1045] Access denied for user
'mareofni_twocit'#'localhost' (using password: YES) in
lock_may_be_available() (line 167 of
home/mareofni/public_html/twocities/includes/lock.inc).
The "MySQL Databases" section of cPanel says that the database and user still exist. When I use the "check database" feature, it gives this error message:
Error from MySQL query: DBD::mysql::db do failed:
Unknown database 'mareofni_twocit'Failed to use
mareofni_twocit: Unknown database 'mareofni_twocit'
"Repair database" in cPanel doesn't fix the problem, and gives the same error message.
Error from MySQL query: DBD::mysql::db do failed:
Unknown database 'mareofni_twocit'Failed to use
mareofni_twocit: Unknown database 'mareofni_twocit'
I tried looking at the databse in phpMyAdmin, but phpMyAdmin doesn't list the database - like it can't tell that it exists.
Is there anything I can do to fix this problem myself, or prevent it happening again the next time I install Drupal? Some insight on what the problem is would also be helpful.
(Line breaks in the error messages are mine, added for readability.)

I've figured out that I cannot create database users who are able to drop databases, and the user I access phpMyAdmin through also cannot drop databases. Since phpMyAdmin couldn't find the database at all, I think the database must have been dropped or corrupted (rather than all the tables dropped or something).
This can't be something that Drupal did, since the Drupal user didn't have permission to drop the database. (Unless Drupal managed to corrupt the database somehow; I don't know enough about how that works to be sure of whether it's possible.) I suspect there's a bug in cPanel, Softaculous, or some other software put there by the hosting company that caused it. Maybe it didn't like that I re-created the DB immediately after deleting it.
I'm trying again with a different database name and crossing my fingers.

Related

#1044 - Access denied for user 'root'#'localhost' to database 'information_schema'

Someone sold us a script and not sure if it's working so I need to test it before it's too late however I'am getting the error "#1044 - Access denied for user 'root'#'localhost' to database 'information_schema'"
I wasn't able to put the code entirely so here is the pastebin link : http://pastebin.com/P4dPRHaf
I searched but couldn't really find a lot of help since i don't have experience on those stuff .note that I'am using Wamp server & getting this error when I try to import the .SQL file on PHPmyAdmin I guess that information_schema already exists on the database however not sure what part should I delete etc...
It's saving you from yourself.
You should not be running statements on the info schema db (unless you REALLY know what you're doing). The database serves as a "meta" repository that dictates how the server operates. Chances are that you have no need to touch it and you'll likely brick your server if you do.

Warning: mysql_select_db() Access denied for user ''#'localhost' (using password: NO)

I am fairly new to web dev and I am in need of help trying to find out what the problem is. I had an install of MySQL 5.6.10 and I was given a task to update the src of a website that is currently live for past 5 years. None of the code has changed and it works for the other devs local machine. The server is running 5.0.51b and I just downgraded to 5.5.30 trying to get a syntax error to go away. The error was the SET OPTION SQL_BIG_SELECTS=1 was deprecated to SET SQL_BIG_SELECTS in a certain version. I am unable to change the syntax due to the version the server runs. So I chose to down version to 5.5.30.
My problem after the down grade is:
Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user
''#'localhost' (using password: NO) in C:\Program Files (x86)\Apache Software
Foundation\Apache2.2\htdocs\****\src\www\include\func\func.db.php on line 47
I use MySQL Workbench for my connections none of the connections or users have passwords associated with them. I have another project that is not live that works fine from the localhost. My vhost and host files all have the proper syntax for this to work (verified with the other project). This all worked properly and was able to bring up the pages through vhost just fine yesterday. I never had any issues with how it was all setup to pull the index page. The only problem was the MySQL version issues. What can I do to fix this problem? I have tried recreating connections in the workbench and even deleting all the instances and recreating them. I am stumped. Any help would be greatly appreciated.
You can see this error because you haven't connect your mysql database properly.
mysql_connect("HOST","USER","PASSWORD")
make sure the host, username and password is corrent
Was MySQL the only thing you upgraded? Any chance you upgraded PHP and now no longer have register_globals on? If you have it off and your colleagues have it on, this could explain the differences you are seeing.
http://php.net/manual/en/security.globals.php
Looking closely at your error you can see that it's telling you what is wrong (typically what error reports are for):
Access denied for user
''#'localhost' (using password: NO)
Looking specifically at:
''#'localhost'
^^
You see that no user was specified. You need to specify the user you wish to connect as.
mysql_connect("HOST","USER","PASSWORD")
Which comes before a mysql_select_db call.
MySQL Connect
& MySQL Select DB
NOTICE: Don't upgrade to PHP 5.5 for MySQL_* functions have been deprecated. I say this since you do not wish to change any code.
From what I am seeing in the error that has been returned, you did not pass the connection a username to use to connect to MySQL.

Mysql access denied

Okay so heres the situation. I have just had to move servers due to budget cuts so the new server is a webfusion VPS. I am now getting an access denied error on all mysql queries. This is the specific error:
Access denied for user 'www-data'#'localhost' (using password: NO)
I do not know what is causing this. I have a database with the mysql username and password stored in a different php file. The username shown in the error is not the same as the actual ussername and I am using a password. It is my understanding that you can put your own php.ini file in the webfusions root and that will work. Is there something I have missed? I have been running on coffee today so that could be why. The mysql database is on the same server btw.
It could be a couple of things. I guess let's start with what is correct.
Your MySQL server address is correct and your webserver is able to connect to it. This should be a given since your webserver and MySQL server appear to be on the same machine.
The username you are using is www-data. That is the first thing I would check. Make sure that is the proper username.
Now check your password. It looks like you are trying to not have to use a password. Chances are that is incorrect (and if it is correct, you really should think about changing that).
Other than that, there is not much else that could be going wrong there. Are you intending to connect to the MySQL server that is on the same machine as your website?
Did you create the appropriate MySQL users after you migrated the database? Grant tables and user privileges are usually not transferred while doing a DB migration (unless you are using some specific tools like the ones provided by Percona etc.)

whats meaning of "Error establishing a database connection"

i have one wordpress blog name as
http://shareprogrammingtips.com/
its hosted on hostgator and works fine. But suddendly i am getting error like
Database Error:
Error establishing a database connection
when i open my blog.
i have not done anything with php my admin of my webspace. i havent touch any setting still i am getting this.
why this error comes and how can i remove that ?
Chances are there is an issue with one of the following:
The database server is down (try connecting via a MySQL client such as PHPMyAdmin or the MySQL admin tools http://dev.mysql.com/downloads/gui-tools/5.0.html)
Incorrect username/password
Your username/password is correct however you don't have permission to connect from your current hostname (e.g. database only allows local connections).
You specified a database table that does not exist.
If you have't changed anything in the site wp-config.php or in Wordpress at all, it's probably nothing more than a temporary glitch at your webhost. Open a ticket with them.
Hostgator places a limit that database can consume only 25% of total memory assigned to a hosting account. You have mysql server going away that crashed your server.Kind of "Memory Issues" if it is repeatedly occuring the hostgator support will finally ask you to upgrade

Plesk assign privileges to database user. "No privileges" error

I am new with Plesk, I used cPlanel whole this time, and never had problems like this.
I created database on subdomain and add user to that database, and when I enter in phpMyAdmin i get error "No Privileges". I cannot connect to database trough php because of this.
This is how it looks
http://imageshack.us/photo/my-images/9/unledpyzx.png/
priv http://imageshack.us/photo/my-images/9/unledpyzx.png/
Thank you in advance
Plesk doesn't give you permissions to create databases through the phpMyAdmin tool, and instead gives you a different interface for creating databases. It looks like you've already completed that step, so you should be fine. The next thing you need to do is define your db structure, which you can do using phpMyAdmin.

Categories