Do Backups Work?

Permalink 2 users found helpful
Hi

anyone used the 'Backup & Restore' feature in the 'System & Maintenance' section of the Dashboard?

I'm trying to use it to migrate my entire C5 from a development server to my live server.

I'm copying the created .sql file from my development server to /files/backup on the live server.

The first issue is that the backup is generated with just 'DROP TABLE', instead of 'DROP TABLE IF EXISTS' - so I replaced all of those.

Now I think I'm getting errors because there are single quotes everywhere.

Anyone got this working?

Cheers
Russell

russellfeeed
 
russellfeeed replied on at Permalink Reply
russellfeeed
Investigations have led me to believe that some of my problem is due to the MySQL configuration:http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity....

The originating server is set to create table names in lowercase and to being case-insensitive (lower_case_table_names=1)and the target server is set to case sensitive (lower_case_table_names=)). I think.

Really, the backup files generated by the Dashboard backup should ensure the table names in the backup .sql file match those in the relevant db.xml files in concrete/config and in the packages.

So if the db.xml calls a table 'MyTable', the backup file should do CREATE TABLE 'MyTable'... not CREATE TABLE 'mytable'. This should be regardless of the server's lower_case_table_names setting
russellfeeed replied on at Permalink Reply 1 Attachment
russellfeeed
Hi all

after struggling with the different case sensitivity settings on two servers I ended up writing the attached PHP script which will fix the names in the .sql Backup File.

So if you're having problems migrating your database from one server to another because of tablenames, this script may help.

I urge you to open and understand the script before using. You need to modify the filename here:

// -------------------------
// CHANGE THIS!!!!
$file = "dbu_1284384291.sql";



I've tried to handle Backup types from both C5 itself and MySQL Administrator - they output slightly different .sql files.

DON'T BLAME ME IF YOU TRASH YOUR DATABASE!

TAKE BACKUPS!!

Cheers
Russell
Ricalsin replied on at Permalink Reply
Ricalsin
If your development environment is a windows system then it will convert the table names to all lower case.

You "get away with" lower case table names within the Windows environment because Windows is case-insensitive, but lots of trouble when you move to Linux, which is case-sensitive (and c5 was written for Linux). You end up with nothing cause nothiN doesn't equal nothin. (Hey, that's a song, right?)

Here's the solution:

In your my.ini file of your Windows (development environment) MySQL you need to place this code INSIDE the [mysqld] section of the ini file:
lower_case_table_names=2
Shotster replied on at Permalink Reply
Shotster
I just experienced a similar issue. I had attempted to import a backup that was created with the C5 dashboard utility using a MySQL admin client running on my local machine. All the tables were created, but none of the data was inserted. I noticed that in the C5 export, none of the table names in the INSERT statements were enclosed in backticks. I'm not sure if that's the issue, since I wound up just exporting and importing using my local DB admin app. If I determine that's the issue for sure, I'll post back.

-Steve
mixedpixel replied on at Permalink Best Answer Reply
mixedpixel
Mnkras replied on at Permalink Reply
Mnkras
adding this to the moving a site tutorial ;)
mixedpixel replied on at Permalink Reply
mixedpixel
:)
jcadbiz replied on at Permalink Reply
And why isn't the solution to force table saves and lookups to all lowercase? (lower_case_table_names=1)? Or is this simply mysql pre 5.0 or something? It seems they have taken care of the problem.

Note there appears to be some bad advice here about what to set this value. Here is the official link w table of values - judge for yourself.

http://dev.mysql.com/doc/refman/4.1/en/identifier-case-sensitivity....