Solved

MySQL - access denied for user to database 'database' (there is no database named database, nor should there be)

Posted on 2016-08-01
3
6 Views
Last Modified: 2016-08-06
Hello

I'm not sure what is wrong here, I'm guessing at some point someone had run an incorrect MySQL command or something, but have't found a solution to fix this.

Basically, users cannot use their database. I even tried creating a new mysql user as a test, gave it rights to a database, and it has the same error.

The user can "show databases", but when trying to use a database the error is:

(the xxxx's are just to mask out the real names)

mysql> use database xxxxxx;
ERROR 1044 (42000): Access denied for user 'xxxxxxx'@'%' to database 'database'

Open in new window



There is no database named 'database' on this server, there never was. For the heck of it I tried to create a database named 'database' just to see what would happen and it won't let me create a database called database anyway:

mysql> create database database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the r
ight syntax to use near 'database' at line 1
mysql>

Open in new window




So I have no idea why suddenly it's expecting MySQL users to be able to access a database named 'database'.


I checked the 'db' table in the 'mysql' database, and there's no sign of this database database.



Here's somewhere else where I do get the error - when trying to use the database 'information_schema':


mysql> use database information_schema;
ERROR 1049 (42000): Unknown database 'database'
mysql>

Open in new window


(above as done as the MySQL root user)




Any ideas how to repair this?

Thanks
0
Comment
Question by:Vas
  • 2
3 Comments
 
LVL 6

Expert Comment

by:Mukesh Yadav
ID: 41737358
This command is incorrect "mysql> use database information_schema;"
It is "mysql> use information_schema;"

You can't use reserved keyword as db name, table name, view name "create database database;"
You can't create a database with name database;
0
 
LVL 1

Accepted Solution

by:
Vas earned 0 total points
ID: 41737899
Thanks, that was my bad when testing via cmd, but there was the same error when trying to login using MySQL Front.

The fix ended up being to reset the MySQL user password.  This may related to an upgrade from MySQL 5.1 to 5.5 possibly.
0
 
LVL 1

Author Closing Comment

by:Vas
ID: 41745363
resolved now
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now