Today I've had to make it so. I already have windows db in lower case and need to import to linux db with case sensitive table names, so the play with lowecase_table_names option in not an option :)
It looks that 'show tables' displays appropriately sorted table names and the dump have escaped table names with ` character. I've succesfully imported the database with following algorithm:
- I have mydb.sql with lowercase windows dump
- I started application to create database schema in Linux, with case sensitive names.
Then I've had lower case names in dump, and case sensitive names in mysql database. I converted the dump using sed & awk with following script:
#!/bin/bash
MYSQL="mysql -u root -p mydb"
FILE=mydb.sql
TMP1=`mktemp`
TMP2=`mktemp`
cp $FILE $TMP1
for TABLE in `echo "show tables" | $MYSQL`; do
LCTABLE=`echo $TABLE| awk '{print tolower($0)}'`
echo "$LCTABLE --> $TABLE"
cat $TMP1 | sed "s/\`$LCTABLE\`/\`$TABLE\`/" > $TMP2
cp $TMP2 $TMP1
done
cp $TMP1 $FILE.conv
rm $TMP1
rm $TMP2
And the dump has been converted properly. Everything works after import in Linux.