Hi Alastair, You don't have a password for root set. The syntax for mysql (the client) would put your #mysql -u root <password> as setting the database to <password>.
If you use the -p option, even if you don't supply a password, it will be rejected if no password is set. You may like to check out http://dev.mysql.com/doc/refman/5.0/en/privilege-system.html Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -----Original Message----- From: Alastair Roy [mailto:[EMAIL PROTECTED] Sent: Thursday, 27 October 2005 6:23 PM To: 'sheeri kritzer' Cc: mysql@lists.mysql.com Subject: RE: PHP and mysql Thanks for your reply I think this is the issue I don't think root is allowed to login from local host I created another user called web user and changed the script, that works fine, next question is how do I set the permissions for root in mysql to allow root to login, if I use #mysql -u root <password> I go straight in If I use #mysql -u root -p <password> I get access denied for [EMAIL PROTECTED] -----Original Message----- Visit our websites: http://www.dailysnack.com "bite size news and gossip" http://www.express.co.uk The Worlds Greatest Newspaper http://www.dailystar.co.uk Simply The Best 7 Days A Week http://www.happymagazine.co.uk The One Stop Shopping Magazine http://www.ok.co.uk First For Celebrity News http://www.northernandshell.co.uk The Mark Of Excellence http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive Also visit: The NMA: Opening Up Newspapers http://www.nmauk.co.uk ###2004### ________________________________________ Any views or opinions are solely those of the author and do not necessarily represent those of Express Newspapers ________________________________________ The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.If you are not the intended recipient of this message please do not read ,copy, use or disclose this communication and notify the sender immediately. It should be noted that any review, retransmission, dissemination or other use of, or taking action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. E-mail communications may be monitored. ************************************************************************ **** ##EXN2000## From: sheeri kritzer [mailto:[EMAIL PROTECTED] Sent: 25 October 2005 18:06 To: Alastair Roy Cc: mysql@lists.mysql.com Subject: Re: PHP and mysql Yes. Whenever you have a problem, go back to basics. Can you login as root on the commandline? What password do you use there? Once you're there, check root's permissions, but I'd be willing to bet your password is incorrect, or root is only allowed to logon from localhost and not the machine the webserver is on. -Sheeri On 10/25/05, Alastair Roy <[EMAIL PROTECTED]> wrote: > Greetings everyone, I am having a problem with PHP and mysql I have copied a > script exactly off a website to open the database and insert a new user I > try to access the mysql database using the root user, and enter information > into the user table, this is the PHP I am using > > > > <? > include 'library/config.php'; > include 'library/opendb.php'; > > $query = "INSERT INTO user (host, user, password, select_priv, insert_priv, > update_ priv) ". > "VALUES ('localhost', 'phpcake', PASSWORD('mypass'), 'Y', 'Y', > 'Y')"; > mysql_query($query) or die('Error, insert query failed'); > > $query = "FLUSH PRIVILEGES"; > mysql_query($query) or die('Error, insert query failed'); > > include 'library/closedb.php'; > ?> > > > > When I try this I get the access for user [EMAIL PROTECTED] host denied, it is > driving me nuts no matter what I try I get the same thing other scripts I > have tried do the same thing, have tried messing around with the config.php > and opendb.php included scripts but nothing works if I run php -f opendb.php > I get no errors which I think means it is working, then again I don't know. > > > > Anyone have any ideas ?? > > > > Thanks in advance > > > Visit our websites: > > http://www.dailysnack.com "bite size news and gossip" > > http://www.express.co.uk The Worlds Greatest Newspaper > > http://www.dailystar.co.uk Simply The Best 7 Days A Week > > http://www.happymagazine.co.uk The One Stop Shopping Magazine > > http://www.ok.co.uk First For Celebrity News > > http://www.northernandshell.co.uk The Mark Of Excellence > > http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive > > > > > Also visit: > > The NMA: Opening Up Newspapers http://www.nmauk.co.uk > > ###2004### > ________________________________________ > Any views or opinions are solely those of the author > and do not necessarily represent those of Express Newspapers > ________________________________________ > The information transmitted is intended only for the person > or entity to which it is addressed and may contain confidential > and/or privileged material.If you are not the intended recipient > of this message please do not read ,copy, use or disclose this > communication and notify the sender immediately. It should be > noted that any review, retransmission, dissemination or other > use of, or taking action in reliance upon, this information by > persons or entities other than the intended recipient is prohibited. > E-mail communications may be monitored. > ************************************************************************ **** > > ##EXN2000## > > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]