BYO DB...Site questions

Build Your Own Database Driven Web Site Using PHP & MySQL book(PDF version) questions:

Using OS X10.6, Apache pre-installed, MySQL installed and running.
Chap 1, page 44 root password setting:
Opened Terminal and pasted in: mysqladmin -u root status

Returned: Uptime: 8957 Threads: 1 Questions: 32 Slow queries: 0 Opens: 34 Flush tables: 1 Open tables: 27 Queries per second avg: 0.3

I take this as proof that mysqladmin is running normally. Correct?

Currently, I seem to NOT have set a password (although I have a note that I did set one a couple of months ago!). I used the mysqladmin -u root -p password “newpassword” with no apparent change. Page 47 says if I enter mysqladmin -u root status (without a password request) I should now get an “Access Denied” error. Simply entering the command and pressing enter/return, results is the same report:

mysqladmin -u root status
Uptime: 10112 Threads: 1 Questions: 42 Slow queries: 0 Opens: 34 Flush tables: 1 Open tables: 27 Queries per second avg: 0.4

I’m confused…again! :wink:

Pressing on…

mysql -u root -p gets me the “Welcome to MySQL monitor…” and the mysql> prompt.

Page 58, test the “show databases;” command: Results in the four databases installed:[INDENT]information_schema
test[/INDENT]OK, fine. Now to live a little dangerously and use the “drop database test;” command. “No on my watch!” All I get is:

ERROR 1010 (HY000): Error dropping database (can’t rmdir ‘./test/’, errno: 17)

I decided to not let little things like this deter me, so I used the “create database” command successfully to create a new one. Nothing in it, of course. Now, I can use the “drop database” command to delete that newly created database. Why? Is this a change (like the addition of the fourth database in the default setup/install)? Or, am I just an all-powerful newbee?! :rofl:

The database test was probably created by the installer, and my guess is that the ./test/ folder has permissions that don’t allow the mysql daemon to remove it. Not sure where the datafiles are stored on OSX, but if you can find them you could check the permissions.

The other database you created, the files and folders for that were created by the daemon, and so it has permission to remove them from the file system when you issue the DROP command.

The database test was probably created by the installer, and … has permissions that don’t allow the mysql daemon to remove it.
Agreed, it was created along with thousands of other files. :slight_smile: And I’m really not complaining that the file/database was not dropped/deleted my my simply entering the command.

What is confusing/frustrating is to have the author say completely the opposite would happen with that command ( “drop database test” ). This may also be a result of changes made in the MySQL version used when the book was ‘printed’ and the one I have installed, making it more “idiot-proof.” There is a change posted in the books errata list noting that later versions of MySQL have four databases installed instead of the three listed in the original text.

Thanks for your response! Hopefully, there won’t be too many other ‘differences’ in what is “fact” and what is “reality.” :shifty: Perhaps I can contact the author directly, also.

I’m not sure what OS the author was using, but if it’s Windows then he didn’t have to worry about permissions at all (hence, the DROP command would work without problems).

The thing is that PHP and MySQL change a lot very quickly. I’d almost go so far as to say that a book is out-of-date as soon as it’s released :expressionless: But don’t worry, if you do encounter other things, then I’m sure they won’t be too large. As to what is “fact” and what is “reality”, that’s getting a little too metaphysical for a Wednesday afternoon. :smiley:

He probably uses both! Scary! :lol: Most of the screen-shots seem to be from OS X, at least in the first few chapters. Thanks for your ‘encouraging’ words about PHP changing!:wink: I’m almost beyond the age of keeping up with changes ( ~68! ) but that means PHP may be a good way to exercise what’s left of my brain! :rolleyes:

Speaking of exercised brains, your English seems perfect! Probably the result of the continued teaching of multiple languages in Europe. We Americans are arrogant enough to expect everyone else to speak English! Except the British, of course… :rofl:

BTW, if it doesn’t stop raining around here, we may start thinking of building some water-pumping windmills!!! :eek:

Thanks again for your help!

Thanks! I actually lived in England for 11 years (went to school there etc.) which is where I learnt most of my English. But most of our TV here is from the US or the UK and is subtitled, not dubbed. That also helps a lot.