If you ever find yourself in need to adjust some MySQL settings and you're running a MAMP server on Mac OS X, you can always create a my.cnf file using the following command:
sudo cp /Applications/MAMP/Library/share/mysql/my-medium.cnf /Applications/MAMP/Library/my.cnf
You now have created your own my.cnf file where you can adjust some settings. Please make sure restart your MySQL instance after altering the configuration.
You have a few other starting point for creating a my.cnf file. MAMP ships with 5 configuration files for some typical settings. The filenames should be self explanatory:
./Library/share/mysql/my-huge.cnf
./Library/share/mysql/my-innodb-heavy-4G.cnf
./Library/share/mysql/my-large.cnf
./Library/share/mysql/my-medium.cnf
./Library/share/mysql/my-small.cnf
Update: Beware: The my.cnf file might enable binary logging. This may create huge log files (gigabytes). Check out webchick's post how to disable mysql binary logging.
I have had this one 2 times now. And it's always the same thing: too many fields in CCK.
Too many fields means too large queries to update the cache. And then MySQL goes down with this nice error message.
How to solve this? Increase the max_allowed_packet to a bigger number in your my.cnf (linux) or my.ini (windows).
If it's not there just add it.
max_allowed_packet=32M
Problem solved!
The following tip can be used in multiple scenarios (being anywhere you need custom URL rewriting and want to do this without .htaccess), but I'll illustrate it for two specific purposes.
Both of these cases can be tackled by one hook (custom_url_rewrite) in Drupal that has to be specified in the settings.php file. You can find a descent explanation of how this hook works in the Drupal API.
In the following example I rewrite all admin urls to config (and vice versa).
function custom_url_rewrite($op, $result, $path) {
if ($op == 'alias') {
if (preg_match('|^admin(/{0,1}.*)|', $path, $matches)) {
return 'config'. $matches[1];
}
}
if ($op == 'source') {
if (preg_match('|^config(/{0,1}.*)|', $path, $matches)) {
return 'admin'. $matches[1];
}
}
return $result;
}