Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 37.9Mb
PDF (A4) - 37.9Mb
PDF (RPM) - 33.0Mb
HTML Download (TGZ) - 8.0Mb
HTML Download (Zip) - 8.1Mb
HTML Download (RPM) - 6.9Mb
Man Pages (TGZ) - 132.9Kb
Man Pages (Zip) - 189.5Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
Excerpts from this Manual

B.5.2.1 Access denied

An Access denied error can have many causes. Often the problem is related to the MySQL accounts that the server permits client programs to use when connecting. See Section 6.2, “The MySQL Access Privilege System”, and Section 6.2.9, “Troubleshooting Problems Connecting to MySQL”.

User Comments
  Posted by Todd Bailey on June 29, 2005
I had this problem and discovered that the user's password became corrupted, using the root account I did an update and reset the user password to a know value.

  Posted by Doug Poston on July 24, 2005
Maybe obvious to some but…
You need to connect to a database before anything will work. If you get errors like 'access denied xxx@localhost' it may be because you have not connected to a database yet.
Even though the service is running you can't do anything without first connecting to a database.
One way to do this, is open the 'MySQL Command line client' installed in Windows when you run the '' file
Click Start button then 'Programs' , 'MySQL', 'MySQL Server 4.1', 'MySQL Command line client'
If it asks for a password key it in, hopefully you remembered it when you installed the MySQL. If not rerun the wizard by clicking Start button,
'MySQL', 'MySQL Server 4.1', 'MySQL Server instance config wizard'

At the prompt MySQL> key in this
connect yourdatabasename
Such as
connect test
test is a sample database installed for you. It has no tables though. You can create a table by keying in this at the prompt
Create Table sample (ID int, FName char(20), LName char(20)); <<< don’t forget the semicolon
Then add data to the sample table key this in at the prompt
Insert Into sample (ID, FName, LName) values (1, 'fred', 'flintstone');

If you don’t put a semicolon at the end of a SQL line you will get a new -> each time you hit the Enter key.

  Posted by Jon Webb on January 24, 2007
PHP520, MYSQL5027, WinServer2003r2

i created a database with no tables
i created a user with no privileges (testuser,testpw,localhost)

$MYlink=mysqli_connect($MYhostname$MYusername$MYpassword$MYdatabase) or trigger_error(mysqli_connect_error(),E_USER_ERROR);
printf("Host information: %s\n"mysqli_get_host_info($MYlink));

This gave an Access Denied error.
But it works with mysql_connect() !!!!!!!!!!!!!

Solution: give the user a GLOBAL SELECT privilege
or create a table and give a SELECT priviledge to the table.

Hope this helps.
Sign Up Login You must be logged in to post a comment.