How can I get mysqldump to preserve the case of table names? - cross-platform

I'm attempting to migrate a database from a windows to a linux host.
Thanks!
Ashley

You are not finding the the table names under linux mysql, coz its default is case-sensitive.
And for windows its case-insensitive.
I can't guess if ignoring case sensitivity works for you. But you can do by adding a line in my.conf. i.e. making mysql in linux to be case insensitive.
mysqlserver:~# vi /etc/mysql/my.cnf
...
[mysqld]
lower_case_table_names = 1

Check out the following links and see if that helps:
http://bugs.mysql.com/bug.php?id=33898
http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html

Bug 33898 suggests setting lower_case_table_names=2.

Related

Renaming a Yakuake session from commandline

Yakuake provides a hotkey and a GUI way to rename commandline tabs/sessions.
I'd like to do the same via the command line, so I can script it and use it in an alias. (My goal is that if I use an alias which does an SSH to some server, then the tab is renamed according to this servers name...)
I tried the suggestions shown here Renaming a Konsole session from commandline after ssh so far no luck.
Since KDE4, one should use qdbus to control KDE apps (instead of deprecated and deleted DCOP).
For example, to change a title of the first session one may use:
qdbus org.kde.yakuake /Sessions/1 org.kde.konsole.Session.setTitle 1 "New title"
To explore available interfaces, methods and properties one may use qdbusviewer.
As a homework try to get a list of active sessions (before you going to change smth).
Like #fgysin pointed out, his command also works for me. BUT it needs the ` character and not " for the subcommand :
qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.activeSessionId
It gives :
qdbus org.kde.yakuake /yakuake/tabs org.kde.yakuake.setTabTitle `qdbus org.kde.yakuake /yakuake/sessions org.kde.yakuake.activeSessionId` "NEW TAB TITLE";

Weird REDIS chars at console?

I have installed the latest version of Redis v2.8.9 from MsOpenTech
The server is up and everything is ok.
But when I invoke the redis-cli.exe and type in the word info : I see each char {each click} with weird info around it :
With previous version (2.8.4) of redis , it doesn't happen and all chars displayed normally.
Question
What are those extra chars ? and how can I make it to be displayed normally ?
nb - windows 8 / 64bit
They look like ANSI character control code used to format and colorize the display. Use an ANSI compliant terminal, or set the FAKETTY environment variable, or use the --raw option.
Apparently it was a bug which was fixed in a newer version :
https://github.com/MSOpenTech/redis/issues/118

How to split sql in MAC OSX?

Is there any app for mac to split sql files or even script?
I have a large files which i have to upload it to hosting that doesn't support files over 8 MB.
*I don't have SSH access
You can use this : http://www.ozerov.de/bigdump/
Or
Use this command to split the sql file
split -l 5000 ./path/to/mysqldump.sql ./mysqldump/dbpart-
The split command takes a file and breaks it into multiple files. The -l 5000 part tells it to split the file every five thousand lines. The next bit is the path to your file, and the next part is the path you want to save the output to. Files will be saved as whatever filename you specify (e.g. “dbpart-”) with an alphabetical letter combination appended.
Now you should be able to import your files one at a time through phpMyAdmin without issue.
More info http://www.webmaster-source.com/2011/09/26/how-to-import-a-very-large-sql-dump-with-phpmyadmin/
This tool should do the trick: MySQLDumpSplitter
It's free and open source.
Unlike the accepted answer to this question, this app will always keep extended inserts intact so the precise form of your query doesn't matter; the resulting files will always have valid SQL syntax.
Full disclosure: I am a share holder of the company that hosts this program.
The UploadDir feature in phpMyAdmin could help you, if you have FTP access and can modify your phpMyAdmin's configuration (or are allowed to install your own instance of phpMyAdmin).
http://docs.phpmyadmin.net/en/latest/config.html?highlight=uploaddir#cfg_UploadDir
You can split into working SQL statements with:
csplit -s -f db-part db.sql "/^# Dump of table/" "{99}"
Which makes up to 99 files named 'db-part[n]' from db.sql
You can use "CREATE TABLE" or "INSERT INTO" instead of "# Dump of ..."
Also: Avoid installing any programs or uploading your data into any online service. You don't know what will be done with your information!

mysql client setting no-auto-rehash conflicting with mysqldump

Our database has many tables with many columns. It takes a long time for the commandline mysql client to connect unless I pass it -A. I'd rather not have to put that in every time, so I tried adding the my.cnf option no-auto-rehash.
That works great until I have to use mysqldump:
mysqldump: unknown option '--no-auto-rehash'
Apparently mysqldump uses the options in my.cnf's [client] section, even if there is a separate [mysqldump] section. Is there any way to use no-auto-rehash and still have a functional mysqldump? Is there a [no-really-just-the-mysql-client] section?
Thanks.
The same question was asked on the mysql forums with no response:
http://forums.mysql.com/read.php?35,583759,583760
Put no-auto-rehash option in the [mysql] section, instead of [client]
[mysql]
no-auto-rehash
In this case mysqldump is functional.
I do this all the time:
[client]
compress
user=uuuuuuu
password=ppppppppp
[mysql]
prompt=\h\_\d>\_
no-auto-rehash
[mysqldump]
quick
max_allowed_packet=1G

DB upload in mysql - loses UTF characters

I'm frequently updating my db on the server, and I run the following line from the command line:
mysqldump -u root --password=mypass mydb|mysql -h mysite.cc -u remotusr --password=remotpsw remotdb
The problem is that it loses the UTF characters along the way.
How can I keep the utf chars in cmd, or what is a better practice doing this?
( Upgrading to an answer )
As documented under mysqldump — A Database Backup Program:
--default-character-set=charset_name
Use charset_name as the default character set. See Section 10.5, “Character Set Configuration”. If no character set is specified, mysqldump uses utf8, and earlier versions use latin1.
[ deletia ]
--set-charset
Add SET NAMES default_character_set to the output. This option is enabled by default. To suppress the SET NAMES statement, use --skip-set-charset.
Therefore, unless you have settings in an option file which are overriding these defaults (you can specify --no-defaults to ensure they are not), the output from mysqldump should be more than capable of being redirected to another mysql session without loss of Unicode characters.
Instead, the conversion to a smaller character set appears to be occurring on retrieving & displaying your data from the new database. Since you are using PHP's Original MySQL API for this purpose, despite the warning in the introduction to its manual chapter (below), you should use mysql_set_charset() to set the connection character set.
This extension is not recommended for writing new code. Instead, either the mysqli or PDO_MySQL extension should be used. See also the MySQL API Overview for further help while choosing a MySQL API.