?
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
Medium Priority
?
20 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 9

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

771 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