B.5.2.1 アクセスは拒否されました

「アクセスは拒否されました」というエラーには多くの原因があります。多くの場合、問題はサーバーが接続時にクライアントプログラムに使用を許可する MySQL アカウントに関連しています。セクション6.2「MySQL アクセス権限システム」およびセクション6.2.7「アクセス拒否エラーの原因」を参照してください。

Download this Manual
EPUB - 7.5Mb
HTML Download (TGZ) - 7.1Mb
HTML Download (Zip) - 7.2Mb
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 'mysql-4.1.13-win32.zip' 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.