Re: [PHP-DB] MySQL problem -- new to PHP
On Fri, 14 Feb 2003 11:30:03 +0200 [EMAIL PROTECTED] (Evan Morris) wrote: > Thanks for all the help everyone sent me on this. However, nothing > seems to make any difference whatsoever (except putting the > 'localhost' part in quotes). I am still getting permission denied > errors based on the user credentials. > > I have entered a user into the user table with host='localhost', > user='php' and a password. > I have entered these credentials into the db table also, and given the > various privileges for this user to the specific database. > I have run both mysqladmin reload and mysqladmin flush-privileges. > I have even rebooted the machine. > I have also tried typing GRANT SELECT,INSERT,DELETE,UPDATE TO > php@localhost IDENTIFED BY ***, but this just throws up an error > at the MySQL prompt. > Try: GRANT ALL PRIVILEGES ON *.* TO php@localhost IDENTIFIED BY 'pass' WITH GRANT OPTION; To give user php admin access for testing (you may want to revoke this later). Remember to: FLUSH PRIVILEGES; to put the new privileges into affect. > My PHP page can still not connect to the database. It just says: > > MySQL Connection Failed: Access denied for user: 'php@localhost' > (Using password: YES) > > I know the problem is a permissions thing, because if I connect to the > test database as 'nobody', there is no problem. > Can you connect as php from the prompt? > Again, any and all help will be appreciated. This is ridiculously > frustrating, especially since I have no problem connecting to the > database from a perl script. I am tempted to stop trying to learn PHP > and build my entire web site using perl cgi instead. > You might want to create a new user for testing using the GRANT command above, don't enter anything into the host or db tables as I suspect this is where things are fouled. -- Mike Registered Linux User #247123 It was all very well going about pure logic and how the universe was ruled by logic and the harmony of numbers, but the plain fact was that the disc was manifestly traversing space on the back of a giant turtle and the gods had a habit of going round to atheists' houses and smashing their windows. (Colour of Magic) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL problem -- new to PHP
Thanks for all the help everyone sent me on this. However, nothing seems to make any difference whatsoever (except putting the 'localhost' part in quotes). I am still getting permission denied errors based on the user credentials. I have entered a user into the user table with host='localhost', user='php' and a password. I have entered these credentials into the db table also, and given the various privileges for this user to the specific database. I have run both mysqladmin reload and mysqladmin flush-privileges. I have even rebooted the machine. I have also tried typing GRANT SELECT,INSERT,DELETE,UPDATE TO php@localhost IDENTIFED BY ***, but this just throws up an error at the MySQL prompt. My PHP page can still not connect to the database. It just says: MySQL Connection Failed: Access denied for user: 'php@localhost' (Using password: YES) I know the problem is a permissions thing, because if I connect to the test database as 'nobody', there is no problem. Again, any and all help will be appreciated. This is ridiculously frustrating, especially since I have no problem connecting to the database from a perl script. I am tempted to stop trying to learn PHP and build my entire web site using perl cgi instead. Thanks Evan Morris [EMAIL PROTECTED] Tel: +27 11 792 2777 Fax: +27 11 792 2711 Cell: +27 82 926 3630 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL problem -- new to PHP
When changing/adding permissions to the mysql db for specific users, dont forget to do 'flush privileges'... my 2 cents On Thu, 2003-02-13 at 07:19, Evan Morris wrote: > Hi all > > I am new to PHP (just basically started yesterday). I am currently having a > problem connecting to a MySQL database. > > My sample code is: > > -- > mysql_connect(localhost,"username","password") or die ("Unable to connect to > MySQL server."); > $db = mysql_select_db("DB_NAME") or die ("Unable to select requested > database."); > ?> > --- > > This throws the following error: > > --- > Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to > connect to this MySQL server > --- > > Now, the mySQL server and the web server reside on the same machine. This > warning is therefore saying that this machine does not have permission to > connect to itself. Hmm. I have put entries in the host table and the user > table, using both hostname and ip address, but no luck. I keep getting the > same error. > > What am I doing wrong? > > Any and all help appreciated. > > Thanks > > Evan Morris > [EMAIL PROTECTED] > +27 11 792 2777 (tel) > +27 11 792 2711 (fax) -- Mignon Hunter Web Developer Toshiba International 713.466.0277 x 3461 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL problem -- new to PHP
If you cut and pasted your code, try to put localhost into quotes as well. Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 "Pay It Forward" mailto:[EMAIL PROTECTED] http://accessingram.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 7:20 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL problem -- new to PHP Hi all I am new to PHP (just basically started yesterday). I am currently having a problem connecting to a MySQL database. My sample code is: -- --- This throws the following error: --- Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to connect to this MySQL server --- Now, the mySQL server and the web server reside on the same machine. This warning is therefore saying that this machine does not have permission to connect to itself. Hmm. I have put entries in the host table and the user table, using both hostname and ip address, but no luck. I keep getting the same error. What am I doing wrong? Any and all help appreciated. Thanks Evan Morris [EMAIL PROTECTED] +27 11 792 2777 (tel) +27 11 792 2711 (fax) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL problem -- new to PHP
PHPMyAdmin is just a web-based tool for administering MySQL and it's pretty intuitive, assuming you've used similar tools before. You can download it and read more here http://www.phpwizard.net/projects/phpMyAdmin/ I would recommend SQLYog as an alternative; http://www.webyog.com/sqlyog/index.html as it's VERY intuitive and pretty simple to use. But then you can't beat going straight into the MySQL prompt and learning from there Here are some good links for tutorials and examples; www.php.net and www.mysql.com for searching on specific functions - unless you have the memory of a few Cray computers ;o) http://www.evilwalrus.com http://www.zend.com/zend/tut/ http://www.devshed.com/Server_Side/MySQL/ http://www.devshed.com/Server_Side/PHP/ There are tons out there, but they are good starting points. Good luck, Nick -Original Message- From: Mark Loewenberg [mailto:[EMAIL PROTECTED]] Sent: 13 February 2003 14:01 To: Clarkson, Nick Subject: Re: [PHP-DB] MySQL problem -- new to PHP Well you opened up my question! Do you know where to learn PHPMyAdmin? Thanks in advance, Mark Clarkson, Nick wrote: >Looks like is to do with MySQL permissions. Check your host's (the one you >are trying to connect from) permissions to the server. > >To change permissions, from the MySQL prompt type; > >GRANT ALL ON * TO username@host IDENTIFIED BY password; > >Substitute in username, host and password for your ones. > >Easier to use PHPMyAdmin or SQLYog (www.sqlyog.com) if you're new to it. I'm >pretty new, so learning all the time. > >A couple of links to get you started; >http://www.mysql.com/doc/en/GRANT.html >http://www.mysql.com/doc/en/GRANT.html > >Good luck, > >Nick > > > >-Original Message- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] >Sent: 13 February 2003 13:20 >To: [EMAIL PROTECTED] >Subject: [PHP-DB] MySQL problem -- new to PHP > > >Hi all > >I am new to PHP (just basically started yesterday). I am currently having a >problem connecting to a MySQL database. > >My sample code is: > >-- >mysql_connect(localhost,"username","password") or die ("Unable to connect to >MySQL server."); >$db = mysql_select_db("DB_NAME") or die ("Unable to select requested >database."); >?> >--- > >This throws the following error: > >--- >Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to >connect to this MySQL server >--- > >Now, the mySQL server and the web server reside on the same machine. This >warning is therefore saying that this machine does not have permission to >connect to itself. Hmm. I have put entries in the host table and the user >table, using both hostname and ip address, but no luck. I keep getting the >same error. > >What am I doing wrong? > >Any and all help appreciated. > >Thanks > >Evan Morris >[EMAIL PROTECTED] >+27 11 792 2777 (tel) >+27 11 792 2711 (fax) > > > > > -- Mark Loewenberg 770 428 1071 [EMAIL PROTECTED] http://www.ITSbiz.net Affordable Website Design Website Hosting @ $9.95/month ITSbiz also provides: IT Solutions Phone Systems Phone & Data Wiring Services This private and confidential e-mail has been sent to you by Egg. The Egg group of companies includes Egg Banking plc (registered no. 2999842), Egg Financial Products Ltd (registered no. 3319027) and Egg Investments Ltd (registered no. 3403963) which carries out investment business on behalf of Egg and is regulated by the Financial Services Authority. Registered in England and Wales. Registered offices: 1 Waterhouse Square, 138-142 Holborn, London EC1N 2NA. If you are not the intended recipient of this e-mail and have received it in error, please notify the sender by replying with 'received in error' as the subject and then delete it from your mailbox. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL problem -- new to PHP
Should have added; You don't have to GRANT ALL, obviously you can assign permissions as required so you could just do GRANT SELECT, UPDATE if that is all that is required. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 13 February 2003 13:20 To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL problem -- new to PHP Hi all I am new to PHP (just basically started yesterday). I am currently having a problem connecting to a MySQL database. My sample code is: -- --- This throws the following error: --- Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to connect to this MySQL server --- Now, the mySQL server and the web server reside on the same machine. This warning is therefore saying that this machine does not have permission to connect to itself. Hmm. I have put entries in the host table and the user table, using both hostname and ip address, but no luck. I keep getting the same error. What am I doing wrong? Any and all help appreciated. Thanks Evan Morris [EMAIL PROTECTED] +27 11 792 2777 (tel) +27 11 792 2711 (fax) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This private and confidential e-mail has been sent to you by Egg. The Egg group of companies includes Egg Banking plc (registered no. 2999842), Egg Financial Products Ltd (registered no. 3319027) and Egg Investments Ltd (registered no. 3403963) which carries out investment business on behalf of Egg and is regulated by the Financial Services Authority. Registered in England and Wales. Registered offices: 1 Waterhouse Square, 138-142 Holborn, London EC1N 2NA. If you are not the intended recipient of this e-mail and have received it in error, please notify the sender by replying with 'received in error' as the subject and then delete it from your mailbox. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL problem -- new to PHP
Looks like is to do with MySQL permissions. Check your host's (the one you are trying to connect from) permissions to the server. To change permissions, from the MySQL prompt type; GRANT ALL ON * TO username@host IDENTIFIED BY password; Substitute in username, host and password for your ones. Easier to use PHPMyAdmin or SQLYog (www.sqlyog.com) if you're new to it. I'm pretty new, so learning all the time. A couple of links to get you started; http://www.mysql.com/doc/en/GRANT.html http://www.mysql.com/doc/en/GRANT.html Good luck, Nick -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 13 February 2003 13:20 To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL problem -- new to PHP Hi all I am new to PHP (just basically started yesterday). I am currently having a problem connecting to a MySQL database. My sample code is: -- --- This throws the following error: --- Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to connect to this MySQL server --- Now, the mySQL server and the web server reside on the same machine. This warning is therefore saying that this machine does not have permission to connect to itself. Hmm. I have put entries in the host table and the user table, using both hostname and ip address, but no luck. I keep getting the same error. What am I doing wrong? Any and all help appreciated. Thanks Evan Morris [EMAIL PROTECTED] +27 11 792 2777 (tel) +27 11 792 2711 (fax) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This private and confidential e-mail has been sent to you by Egg. The Egg group of companies includes Egg Banking plc (registered no. 2999842), Egg Financial Products Ltd (registered no. 3319027) and Egg Investments Ltd (registered no. 3403963) which carries out investment business on behalf of Egg and is regulated by the Financial Services Authority. Registered in England and Wales. Registered offices: 1 Waterhouse Square, 138-142 Holborn, London EC1N 2NA. If you are not the intended recipient of this e-mail and have received it in error, please notify the sender by replying with 'received in error' as the subject and then delete it from your mailbox. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL problem -- new to PHP
Hi all I am new to PHP (just basically started yesterday). I am currently having a problem connecting to a MySQL database. My sample code is: -- --- This throws the following error: --- Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to connect to this MySQL server --- Now, the mySQL server and the web server reside on the same machine. This warning is therefore saying that this machine does not have permission to connect to itself. Hmm. I have put entries in the host table and the user table, using both hostname and ip address, but no luck. I keep getting the same error. What am I doing wrong? Any and all help appreciated. Thanks Evan Morris [EMAIL PROTECTED] +27 11 792 2777 (tel) +27 11 792 2711 (fax) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php