Fix how MySQL is handled in various features and tune up some minor
bugs.