473,750 Members | 2,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access denied for user: username@%

red
I know this is probably a faq but it is hard to search for this exact
problem.
When I put this on a php page:
<?
$link = mysql_connect(" localhost", "cardini", "password")
or die("Could not connect : " . mysql_error());
echo "Connected successfully\n" ;
mysql_select_db ("articles") or die("Could not select database");
$sql = 'CREATE TABLE image( id mediumint( 8 ) unsigned NOT NULL
AUTO_INCREMENT ,'
. ' masterid mediumint( 8 ) unsigned NOT NULL default \'0\','
. ' filedata blob NOT NULL ,'
. ' PRIMARY KEY ( id ) ,'
. ' KEY master_idx( masterid ) ) TYPE = MYISAM ';
mysql_query($sq l);
db(mysql_error( ));
?>
This is the result:
Connected successfully

[Access denied for user: 'cardini@%' to database 'articles']

How can it connect successfully to the database, yet with the same user
and password, fail to connect ?

or maybe a better question would be: How did 'localhost' get changed to
'@%' ?

Jul 17 '05 #1
3 7093
red
red wrote:
I know this is probably a faq but it is hard to search for this exact
problem.
When I put this on a php page:
<?
$link = mysql_connect(" localhost", "cardini", "password")
or die("Could not connect : " . mysql_error());
echo "Connected successfully\n" ;
mysql_select_db ("articles") or die("Could not select database");
$sql = 'CREATE TABLE image( id mediumint( 8 ) unsigned NOT NULL
AUTO_INCREMENT ,'
. ' masterid mediumint( 8 ) unsigned NOT NULL default \'0\','
. ' filedata blob NOT NULL ,'
. ' PRIMARY KEY ( id ) ,'
. ' KEY master_idx( masterid ) ) TYPE = MYISAM ';
mysql_query($sq l);
db(mysql_error( ));
?>
This is the result:
Connected successfully

[Access denied for user: 'cardini@%' to database 'articles']

How can it connect successfully to the database, yet with the same user
and password, fail to connect ?

or maybe a better question would be: How did 'localhost' get changed to
'@%' ?

I figured out what that cryptic messge meant- the user had not been
granted the appropriate privilege, in this case the create privilage.
I was in the middle of granting privilages when I got distracted by the
debate.
Jul 17 '05 #2
Hi there, Red.
Will you please be so kind as to help me out with your solution - I have
the same problem and I am totally new to this.

Regards,
Deon H
Jul 17 '05 #3
red
Deon H wrote:
Hi there, Red.
Will you please be so kind as to help me out with your solution - I have
the same problem and I am totally new to this.

Regards,
Deon H

The problem confused me because my username and password successfully
connected to the database but didn't work when I tried to create a
table. But this does make sense because to create a table you not only
have to have a username and password to connect to the database, you
must have the right to create a table within that database.

I'm using windowsxp, this is how I grant rights:

1)Go to the command prompt. There is a link in the start menu.
2)Change the directory to the directory of mysql. The letters cd are
used to change the directory. On my computer, I write:
cd c:\\mysql\bin
The prompt changes to c:\\mysql\bin>
3)logon to the root account of mysql . If your mysql is set up properly,
simply typing
mysql
without a username and password should give you an access denied
message. If it lets you in without giving you an access denied message,
then you still have a default user which should be deleted.

To access the root account type mysql -u root -p
It will then ask you for your root password and let you in

4) To grant rights, use the grant command. If I want to grant
"myusername " with a password of "mypassword " the rights that most users
are allowed to have to "mydatabase " I would use:

grant select, insert, update, delete, index, alter, create, drop on
mydatabase.* to myusername identified by 'mypassword';

Notice the single quotes around the password. Those are the only quotes
in the whole command.

That fixed the problem for me
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3394
by: Ryan Schefke | last post by:
------=_NextPart_000_0077_01C34C8B.2B90C960 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ..I just sent this out to the win32 distribution list but no one has replied.can someone on this list please help? The issue should be trivial for experienced MySQL users, I'm just a novice, thanks!
8
18470
by: John | last post by:
Hello. I am currently working through a book on Dreamweaver and using PHP. I am having a little trouble with setting up the database though. I have php 4.2.3 and MySQL 4.0.20a. I am running locally with Apache 1.3.27 on Windows XP Pro. I seem to have finally got MySQL running after a lot of difficulty. In the book it says to type source C:\mysql\newland_tours.sql at the mysql> prompt, to generate the newland_tours database in my...
2
2976
by: adnan alsamari | last post by:
Hi, I can only access mysql through the root by typing mysql -u root -p. But when I use any other user to connect to mysql I get the access denied error message. Mysql is installed on windows xp. I looked up information online to solve this problem and saw that there are some scripts that i may be able to run in order to fix the problem. But I am not sure how to handle those scripts since they are only made for unix systems. I tried to...
0
2865
by: c.verma | last post by:
I have a web based (forms based authentication) asp.net application that uses .NET remoting. It has web.config.remoting with all the required settings in it. As soon as it tries to access the website, it threw an error: Access denied attempting to launch a DCOM Server. The server is: {000C101C-0000-0000-C000-000000000046} The user is ASPNET/ServerName, SID=S-1-5-21-1606980848-602162358-1801674531-1007. I tried to find the answer on the...
0
1713
by: robgallen | last post by:
I'm having a wierd issue trying to launch a robocopy process via a web form. To cut a long story short, it works fine when I run it from the server it is hosted on, but when I access the site from my own machine, I get access denied errors. Example on server 'wwwdeploy': http://localhost/Deploy/default.aspx effectively runs this command: robocopy \\wwwdeploy\wwwroot$\project\subfolder \\wwwtest\drop\project\subfolder /S /Z
8
28594
by: ajos | last post by:
hi frnds, im trying to convert my servlets database configuration from ms access to mysql database.however im getting some error like no driver found exception. to verify this error ive made a simple database in jsp(just to check if my mysql is working smoothly otherwise) which access' the username.....but in the process im getting a error--> java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO) i have...
1
2140
by: zlf | last post by:
Hello my website has role based access, and user without specific role assigned cannot access specific page in website. When the user try to access a page who has not been granted to access, the web site should redirect the user to an access denied page. Instead, now they are taken to the splash page to prompt user input username and password. How to redirect the user to an access denied page in that case? Thanks
2
12876
by: =?Utf-8?B?RWRkaWU=?= | last post by:
Here is my scenario for a problem I can't solve. I am hosting a 3.5 WCF service in IIS on Windows Server 2003. The service works fine with the WCF test client in Visual Studio 2008 and from an ASP.Net client hosted on my development machine in VS2008. As soon as I deploy the ASP.net client to the "Same" IIS server, I get Access Denied messages. My goal is to use AD security groups so the authenticated user on the ASP.net page should be...
2
5338
by: =?Utf-8?B?bXVyYWRqYW1lcw==?= | last post by:
Yes, sorry I tried to make it clear in the original question that I want to get the user token of the service - ie. the account the service is running under. I know services don't have user tokens - I suspect users do have tokens, hence "user token", otherwise we might call them "service tokens" or somesuch :-) If you read the question again, you migh see that the fundamental question is, *assuming there is no other approach*: The...
0
9000
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9396
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9339
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6804
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.