linux mysql gt,mysqldump问题是否区分大小写? Win-> Linux

When i dump a table with uppercase letters using mysqldump it comes out as lower case in my > dump.sql file. I found a report here in 2006, almost 4 years old http://bugs.mysql.com/bug.php?id=19967

A solution here suggest making linux insensitive. I rather not if possible. Whats the easiest way to copy a win32 db into linux?

解决方案

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值