BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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 .
I'm new to all this, but even I can see that this is probably a completely dumb thing to ask, but I just can't see an answer. I followed the book exactly as written but when I get to page 23 (23 of 700!), having opened the MySQL monitor for the first time I get the following.
When I type:
mysql> DELETE FROM user WHERE Host='localhost' AND User='';
The response is:
ERROR 1046: No Database Selected
What do I do to make it give me:
Query OK, 1 row affected (0.46 sec)
Can anyone please help so I can get at least 1 chapter under my belt?
I seem to have fixed this now, but following the book it just didn't work with version 4.0.2a. So if anyone else has problems with page 23 this worked on mine.
Entering :
c:\mysql\bin\mysql mysql
gives an ERROR 1044: Access denied for user:'@localhost' to database'mysql'
Now a previous post by BuzzLY said to enter:
c:\mysql\bin\mysql -u root
Which works but then I got the ERROR 1046 as detailed above.
So finally after much fumbling around I entered:
c:\mysql\bin\mysql -u root mysql
Perhaps this is something to do with the version being 4.0.2a .... I don't know.
It is the version thats the problem. 4.0.20a-win & 4.0.20c-win produce the errors but 4.0.15-win works fine with the syntax that is in the book. Also page 24 talks about .cnf files which don't seem to exist in the newer versions. All very perplexing stuff for a newbie, especially when it is a bit of a hunt to find an older version to download.
Carlitio, glad you found the answer to your problem- that's why we tried to encourage the reader to visit the 3 sites: php.net, apache.org, and mysql.com for up-to-date releases/announcements/ bugs/fixes. At the time of writing the publication, we used the most recent stable releases available, but in such a dynamic industry, it is impossible to include things that haven't been released yet. Seeing as how there were 5 releases of MySQL between September and May, you can certainly understand the dilemma we face.
Keep up the good work- you'll be a pro in no time :)
Connect as root using the following command:
mysql -u root -p mysql
After this the prompt will ask you for a password which is set to 'root' as default in newer versions of MySQL. Like this:
-------------------------------------------------------------------
C:\mysql\bin>mysql -u root -p mysql
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 4.0.20a-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql;
-------------------------------------------------------------------
You can set the password for root by using the 'update' command:
-------------------------------------------------------------------
update mysql.user set password='wrox' where user='root'
-------------------------------------------------------------------
This will change 'wrox' as a password for root user.
It is the version thats the problem. 4.0.20a-win & 4.0.20c-win produce the errors but 4.0.15-win works fine with the syntax that is in the book. Also page 24 talks about .cnf files which don't seem to exist in the newer versions. All very perplexing stuff for a newbie, especially when it is a bit of a hunt to find an older version to download.
How did you solve the problem and what is the version you are currently using so i can also use it....
Currently I am using the old versions that are stated in the book. Main reason being I don't want any other little errors like these as I read on. Once I have completed the book and have a bit of experience I will upgrade to the latest versions. So for now :
Apache 2.0.49 (Win32), PHP 4.3.7, MySQL 4.0.15-win