Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 17th, 2005, 01:06 PM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default access denied for new user, Chapter 3

Hi -

Regarding Chapter 3 pg 93-96 - I created the two files createmovie.php and moviedata.php. At the top of createmovie.php I have the following:

<?php

//connect to MySQL using my username and password
$connect = mysql_connect("localhost", "bp5am", "bp5ampass") or die ("Hey loser, check your server connection.");

//create a new main database if it doesn't already exist
$create = mysql_query("CREATE DATABASE IF NOT EXISTS moviesite") or die (mysql_error());

//make sure our properly created database is the active one
mysql_select_db("moviesite"); >>>>>>

As requested on page 93, I went into MySQL and created a new user 'bp5am' on 'localhost' with password 'bp5ampass' and granted this user Select, Insert, and Update privileges.

When I run createmovie.php in my browser, I get the message 'Access denied for user 'bp5am'@'localhost' to database 'moviesite'. And nothing else.

What have I done wrong here? I tried the code I typed AND the code I downloaded with the same result. Please help.

Debbie
Reply With Quote
  #2 (permalink)  
Old February 18th, 2006, 10:33 AM
Registered User
 
Join Date: Feb 2006
Location: Bologna, , Italy.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have the same problem with Linux and Windows
Reply With Quote
  #3 (permalink)  
Old February 19th, 2006, 06:01 AM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Deb whats up? I was surfing around on here and I saw your problem. Troubleshooting this stuff can be a pain from time to time. Im not sure exactly what it can be, but it sounds like it could possibly be a password problem... I want to see if you can log into your mysql in windows using the command prompt... If you are using windows xp...Click on start----Accessories--->click on "command prompt." then type this in cd\ then hit enter..your screen should look like this C:\> 1)now type in net start mysql 2) then hit enter... you should again get that c:\> prompt...this time type in right next to the C:\> C:\mysql\bin\mysql -h localhost -u bp5am -p then hit enter... a message should pop up asking for your password...type in your password which should be bp5ampass and hit enter...if the password doesn't work you should get a message saying Acess denied for user etc etc... reply back to this board and let me know what happens. As in if you got an error.

Reply With Quote
  #4 (permalink)  
Old February 19th, 2006, 06:51 AM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Debbie I think I know what the problem is.... Scratch out what I wrote in the above message... Go into the "command prompt" using the steps I showed you in the post above... once in the command prompt it should display C:> if not type cd\ and hit enter... now it should be C:\> now type c:\mysql\bin\mysql -h localhost -u root -p and hit enter... you must enter the password you created for your root log in password... if you don't know it, it may be bp5ampass as well...but if its not, look in the book and it might show what the password was when going through the steps to set up your mysql... Anyways if you are successful and knew the password you should be logged in now under root as the user (hence the "-u root" part)now your screen should look like this mysql> okay, now the reason you were getting that access denied part was because although you setup a user account in mysql the privileges you gave bp5am were limited you only gave the user bp5am limited privileges such as Select, Insert, and Update... because of this you weren't able to create a new database such as moviesite because you didnt give those privileges when you created the user bp5am...The book kind of screwed up at that part... So what we need to do now is give it those privileges... But I suggest we make a new user... so lets name it "Debbie" because its a nice name. so sense you are logged in as root right now and your screen looks like this mysql> type this in
GRANT ALL PRIVILEGES <---hit enter after that
ON *.* <----hit enter after this
TO debbie@localhost <----hit enter after that
IDENTIFIED BY 'enteryourpasswordhere'; <---dont forget to add those ' ' and ; like I did in the example where your password goes... now hit enter...and it should show you a query result or something... now in the php code for createmovie and moviedata change it so it looks like this $connect = mysql_connect ("localhost", "debbie", "passwordgoeshere") and it should work...Good Luck!

Reply With Quote
  #5 (permalink)  
Old February 19th, 2006, 10:13 AM
Registered User
 
Join Date: Feb 2006
Location: Bologna, , Italy.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Page 24 (for my Italian translation):
Quote:
quote:
mysql> GRANT SELECT, INSERT, UPDATE
-> ON *.*
-> TO edna@localhost
-> IDENTIFIED BY 'ednapass';
As you can see edna can't create database, just
Quote:
quote:
SELECT, INSERT, UPDATE
So for files createmovie.php and moviedata.php of pages 94-96 you must not use
Quote:
quote:
mysql> GRANT SELECT, INSERT, UPDATE
-> ON *.*
-> TO bp5am@localhost
-> IDENTIFIED BY 'bp5ampass';
but
Quote:
quote:
mysql> GRANT CREATE, SELECT, INSERT, UPDATE
-> ON *.*
-> TO bp5am@localhost
-> IDENTIFIED BY 'bp5ampass';
or better, as TheDudeTux said

Code:
GRANT ALL PRIVILEGES
for
Code:
GRANT CREATE, SELECT, INSERT, UPDATE
Hey TheDudeTux, as you can see the question of Debbie is of october 2005, maybe she has just understood from herself the question!
Reply With Quote
  #6 (permalink)  
Old February 19th, 2006, 05:08 PM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hahah thats crazy..I didnt even see when she posted it...how did the post make it all the way to the top? haha Hey Lanc I like your CREATE part too.. I should of done that as well.. But I kinda thought it might have been cool to create a user to have all the privileges for this book just incase. Thanks for replying also! Its hard to get a reply sometimes.
 -TheDudeTux

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 3: access denied tasios BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 February 24th, 2008 12:02 PM
phpMyAdmin - #1044 - Access denied for user crmpicco PHP Databases 0 October 21st, 2007 09:32 AM
1044: Access denied for user '@localhost ... ajutla PHP Databases 3 April 16th, 2005 03:27 PM
Access Denied For User -Chapter 9 AMP_Engineer BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 5 September 25th, 2004 02:18 AM
Access denied for user wisconsin MySQL 13 June 17th, 2004 08:46 PM



All times are GMT -4. The time now is 04:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.