MySQL fixes.

This lets the connection work, but there are (My)SQL errors.