#capitals #database #db #localhost #mac #macos #mamp #mysql #osx #uppercase #wamp
So you work for this company running a rather large web-app completely developed on Windows and you are the first in the office to switch to OSX. Besides the bullying, one problem you can run into is a mysql table case-sensitivity difference between a windows local server setup and a mac local server setup.
Depending on the way your queries are written, they might run fine on one OS but fail on others. It appears Windows automatically ignores table name case when running queries, but osx and linux are stricter (by default). Specifically:
# Querying a table named "tablename": # Not cool: mysql_query("SELECT examplequery FROM TableName WHERE this='Will only work on Windows'"); # Cleaner: mysql_query("SELECT examplequery FROM tablename WHERE this='Will work anywhere'");
Depending on the size of the project and amount of queries, this could be too much manual work. Your colleague devs and project manager will not like this and would have to keep cooperating in the future when writing new queries.
All queries will have to go through your php function and unless you write a complex regexp to only select tables from queries, you will likely run into collisions with (partially) equal table/field names etc.
AKA tell your mysql to stop bitching. You are on a local setup anyway.
The configuration you are looking for is “lower_case_table_names”, which is on 0 (do not convert to lowercase) by default, and should be set to 1 (convert to lowercase). Switching this setting is however not very straight forward on a MAMP setup as normally you’d configure it in my.cnf, MAMP actually boots mysql with the lower_case_table_names=0 enforced – effectively overwriting your my.cnf setting…
So instead, find and open /Applications/MAMP/bin/startMysql.sh in a text editor and set lower_case_table_names to 1.
# /bin/sh /Applications/MAMP/Library/bin/mysqld_safe --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lower_case_table_names=1 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log &
Restart your mysql session & eureka.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>