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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
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…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 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

20 Experts available now in Live!

Get 1:1 Help Now