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
17 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
join tables 4 57
INDEX does not make a difference, why? 10 65
Import MySQL data into MS Access using VB.Net interface 5 52
MySQL recovery 7 33
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

733 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