473,396 Members | 2,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

mysql allows blank username and password

Hi, I'm a bit of a newbie to PHP and mySQL. I'm trying to get things running
on my W2K machine.

I'm having a problem using the mysql_connect() function (although the
problem's probably rooted in mysql). When trying to log in via PHP with the
code "$link = mysql_connect("localhost", "phil", "pwpass123");" I get the
error...

Warning: mysql_connect() [function.mysql-connect]: Access denied for user:
'phil@localhost' (Using password: YES) in c:\inetpub\wwwroot\php\mysql.php
on line 9

The thing is that it connects ok if I leave the username and password blank.
The ones I'm using above are ones I specified in mysqladmin when I first ran
it.

Can anyone help me 1) Stop mysql accepting blank username and password
values, and 2) get it to accept my defined username and password?

Many thanks in advance,
Phil
Jul 16 '05 #1
3 4179
I would hazard a guess that you haven't granted phil the right permissions.

mysql -- user=root mysql
GRANT ALL PRIVEILEGES ON *.* TO user@localhost IDENTIFIED BY 'password' WITH
GRANT OPTION;

I would also guess that root (which is the default) doesn't have a password
set up which is why that works.

HTH.
PWT.

"Phil W" <me@privacy.net> wrote in message
news:bj************@ID-180242.news.uni-berlin.de...
Hi, I'm a bit of a newbie to PHP and mySQL. I'm trying to get things running on my W2K machine.

I'm having a problem using the mysql_connect() function (although the
problem's probably rooted in mysql). When trying to log in via PHP with the code "$link = mysql_connect("localhost", "phil", "pwpass123");" I get the
error...

Warning: mysql_connect() [function.mysql-connect]: Access denied for user:
'phil@localhost' (Using password: YES) in c:\inetpub\wwwroot\php\mysql.php
on line 9

The thing is that it connects ok if I leave the username and password blank. The ones I'm using above are ones I specified in mysqladmin when I first ran it.

Can anyone help me 1) Stop mysql accepting blank username and password
values, and 2) get it to accept my defined username and password?

Many thanks in advance,
Phil

Jul 16 '05 #2
A Martian named "Phil W" <me@privacy.net> telepathically imparted message
<bj************@ID-180242.news.uni-berlin.de> to us on Fri, 05 Sep 2003
05:59:23 -0500:
[snipped mysql login error]
The thing is that it connects ok if I leave the username and password
blank. [...]


Delete the "test" database and make sure that the
"root" user (in mysql) has a password.

By default, anonymous users have access to databases
that start with "test" (I think).

For your login problem, perhaps you are using the wrong
password. See if you can change it with mysqladmin.

Jul 16 '05 #3
"Gary Petersen" <ga*******@remove.meearthlink.invalid> wrote in message
news:pa********************************@REMOVE.MEe arthlink.INVALID...
Delete the "test" database and make sure that the
"root" user (in mysql) has a password.

By default, anonymous users have access to databases
that start with "test" (I think).

For your login problem, perhaps you are using the wrong
password. See if you can change it with mysqladmin.


Cheers Gary, I ended up going back to square one and doing just that.

Also, I think I was getting mixed up with the winmysqladmin - the username
password defined there seems to just get dropped into the my.ini file for
login, whereas I originally thought it was setting that user up too. I could
well be wrong about that though! I think I need to get one of those "for
dummies" books on mysql!
Jul 16 '05 #4

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

Similar topics

2
by: Nathan Given | last post by:
I run a book exchange web site based in PHP with a mysql database. Many users have having trouble logging in. Here is a description of the problem. A user types in his/her username and...
4
by: Bruce A. Julseth | last post by:
My MySQL.user table (user, host, password) looks like the following: +---------+-----------+---------------------+ | user | host | password |...
0
by: yurps | last post by:
Hello, I installed both, 1st mysql 4.1.7 but heard there was a change with password hashing so now got 4.0.9 Basically when I choose a page with php_info() I can load it fine, but when I call a...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
2
by: dalsoth | last post by:
Hi Guys I have created a website and to makes things easier i decided to use dreamweaver to do the secure login section and access levels for the pages. When testing locally on wamp my website...
3
by: focussys | last post by:
hi i am a student and am doing this for one of my assignments i am trying to create a login using perl and mysql database.i was succesful in doing that now i want to use cookies for...
2
by: Boujii | last post by:
Greetings, I have been attempting to make a drop down menu of countries. From this menu I wish to create a variable in order to INPUT into mysql database. I have no trouble making the drop down menu,...
20
by: cmbcorp | last post by:
Hi, I have been playing around with a simple php login script and im getting an error message when i attempt to log in with the username and password i set in the sql table. The error message is...
6
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...

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.