Follow me as I struggle with rogue technology, insane programmers, and impossible math questions in a battle to the death.

Sunday, October 18, 2009

Install MySQL-python 1.2.3b on mac OS X when you get the

I tried to install MySQL-python on Mac OS X 10.5 and I got the error:

EnvironmentError: mysql_config not found

To fix this error, you need to specify the location of your mysql_config in the site.cfg file.

I found mine in /usr/local/mysql/bin/

In the MySQL-python installation directory, open the site.cfg.

Add a line that says:

mysql_config = /usr/local/mysq/bin/mysql_config

Then run sudo python setup.py install again and it should install correctly.

Labels: ,

Tuesday, May 05, 2009

MySql Installation Problem and resolution

A lot of times I've encountered this problem installing MySQL.

When it goes to turn on the service at the end of the installation process, the software firewall stops it from starting the service. When this happens, the security is not applied. Then, I try to run the installation again, and when I get to the point where I'm setting the password, there are 3 password fields instead of 2. Since the the security settings were never applied, there is no password for the first field! But usually I end up trying to put a password in that field, and as a result MySQL fails when it tries to apply security settings.

So, leave that field blank.

Labels:

Friday, December 05, 2008

Compiling python-mysql connector on a Mac

I just received a new Mac Book Pro at work (because my work is super awesome) and I'm trying to install a variety of software. Among this software is MySQL, and the python-mysql connector, so I can use Django with MySQL. I'm finding installing software on a Mac to be rather awkward in general compared to on Windows or Linux. I already tried MacPorts, Fink, and installing from dmg files, and all of them have left a bad taste in my mouth.

With the python-mysql connector specifically, I needed to compile it. Had I not found this page, I probably never would have gotten it working:

How to install Django with MySQL on Mac OS X

One more tip... I tried to use MySQL 64-bit on my Mac Book Pro which was 32-bit, and as a result I had some problems when I tried to make python-mysql talk to MySQL. Be careful about that you use the right version!

Labels: , ,

Thursday, October 30, 2008

Commands to create a MySQL database

I haven't managed to memorize all the intricacies of MySQL data creation and grant commands, so here are the commands I occasionally need:

drop database if exists mydb;
create database mydb;
use mydb;
grant all on mydb.* to 'myuser'@'localhost' identified by 'mypasswd';


Here's the ultra lazy, one line search and replace, insecure, global access version:

drop database if exists foo;
create database foo;
use foo;
grant all on * to 'foo'@'localhost' identified by 'foo';


Note: I usually put my SQL in a file and run the file from the MySQL monitor. Unfortunately, sometimes the grant commands don't work when they're run from a file. As a result, I have to manually type the commands into at the prompt. I don't know why.

Labels:

Tuesday, September 30, 2008

Reset auto increment for a table in MySQL

ALTER TABLE theTableInQuestion AUTO_INCREMENT=1234

That was easy. Someone posted the command in the comments for the Using Auto Increment page in the MySQL manual. I often find that the comments are more helpful than the manual.

Labels: