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
19 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

Webinar: MariaDB® Server 10.2: The Complete Guide

Join Percona’s Chief Evangelist, Colin Charles as he presents MariaDB Server 10.2: The Complete Guide on Tuesday, June 27, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

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

Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

729 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