chhotii: (apple)
[personal profile] chhotii
Rather than get bogged down in trying to make the "right" decision as to what computer to use, what package manager to use (fink, MacPorts, or homebrew), and try to research the "right" way to install compatible versions of MySQL, python, and the glue that would hold them together, I decided to just roll some dice (basically), make some arbitrary decisions, and then hack away at it to try to get things to work. This seems to work, to the limited extent that I need it to.


I chose Ed's old computer, an Intel mac running 10.5.8. Astonishingly, now when you log in as Ed, you are actually logged in as HH; how did they manage to do that? Don't forget to turn on ssh access in System Preferences. Note, Energy Savings preferences on that computer are draconian, may have to change that if I work on this much remotely.

I installed fink. Fink Commander seems pretty easy to use, so I didn't install packages from the command line. Installed the python25 package and the mysql-5 package; those installs seemed to go fine.

However, could not find the package that is supposed to contain MySQLdb. Supposedly there is supposed to be a package whose name starts with mysql-python, according to fink's on-line package database. Don't see it. Tried turning on unstable packages, even though mysql-python is supposed to be stable? No, still couldn't find it. Maybe fink is "helpfully" hiding it, since I hadn't installed Developer Tools, and it was source-only? Installed Developer Tools (which is on the Leopard install DVD). Still no joy. Probably a pre-requisite to what I wound up doing, though.

Installed the mysql15-dev package, as someone on the I'net says you need it to install MySQLdb.

Downloaded MySQLdb from sourceforge. Read the README. No mention of Macintosh support, other than some mutterings about how obscure BSD variants should work. Glance at the installer script, which apparently looks at what python reports as the OS, sees if the word POSIX appears, and if not, decides that it must be Windows. Srsly? OK, here goes nothing: the installation instructions seem to work just out of the can, without tinkering with anything. All kinds of warnings generated, none of which seem too alarming. From a python prompt, import MySQLdb seems to generate some warnings, which seemed pretty alarming, but no outright errors.

What seems to work for stopping and starting mysql, from a local Terminal session:
cd /sw/bin
sudo ./mysqld-safe &


However, in an ssh session, the password prompt trigged by sudo seems to not play nicely with the & at the end. So, a bogus sudo to get that out of the way:
cd /sw/bin
sudo pwd
sudo ./mysqld-safe &

Oh, hey, there are these -v and -b options to sudo that I should know about.

While MySQL is running, this works, as I haven't set a password:
mysql -u root

To shut down MySQL for the evening:
sudo mysqladmin shutdown

Well, the MySQLdb module seems to be working, as the code examples on this web site here work. Oh, except that the "with" keyword isn't implemented in Python 2.5. Which doesn't matter; the script writer didn't actually omit the object reference after using the with keyword. Just delete the with con: line and all is well.

Profile

chhotii: (Default)
chhotii

July 2023

S M T W T F S
      1
2345678
9101112131415
16 171819202122
23 242526272829
3031     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 25th, 2026 08:28 pm
Powered by Dreamwidth Studios