Results 1 to 6 of 6
-
08-30-2007, 03:14 AM #1Web Hosting Evangelist
- Join Date
- Nov 2006
- Posts
- 459
how can i import .sql form mysql 4.1 to 4.0 ?
hi,
i am not sure if this is the right sub-forum to post the question.
it is that i my a forum running with php and mysql,
the version of it is 4.1 now,
i wnat to move the forum to another server,
but the mysql version of the server is 4.0,
i try to backup the .sql form phpmyadmin and import form phpmyadmin,too.
but it failed,
some article tell me that i should change some setting in the .sql file,
but i try and failed,
can anyone teach me how can i process it?
thanks a lot.
-
08-30-2007, 08:07 AM #2Junior Guru
- Join Date
- Mar 2004
- Location
- UK
- Posts
- 215
This is working from memory as it's a long time ago that I last moved a database from 4.1 to 4.0. But you need to edit the file with a text editor. When you export table definitions from mysql 4.1, it includes information on the character set used, so your tables will appear something like this
PHP Code:CREATE TABLE `STATISTICS` (
`COL1` varchar(512) default NULL,
`COL2` varchar(64) NOT NULL default '',
`COL3` varchar(64) NOT NULL default '',
) DEFAULT CHARSET=utf8;
PHP Code:CREATE TABLE `STATISTICS` (
`COL1` varchar(512) default NULL,
`COL2` varchar(64) NOT NULL default '',
`COL3` varchar(64) NOT NULL default '',
);
All this change does is makes mysql use the default character set when you restore the database, which works fine in mysql 4.0. It won't affect your data (unless you have non ascii data in the tables).
HTHMartin
-
08-30-2007, 08:14 AM #3Retired Moderator
- Join Date
- Feb 2005
- Location
- Australia
- Posts
- 5,849
Don't mess with the sql file, make a new database backup in 4.0-compatible mode. From shell:
Code:mysqldump -uuser -p --compatible=mysql40 database >database.sql
Chris
"Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter
-
08-30-2007, 08:15 AM #4Newbie
- Join Date
- Dec 2005
- Location
- Planet Earth
- Posts
- 24
If you have the SSH access then you can generate the MySQL4.0 compatible dump on MySQL4.1 server as:
mysqldump -uUSERNAME -pPASSWORD --compatible=mysql40 DATABASENAME > DUMP.sql
This will generate the dump that can be easily imported on the server running MySQL 4.0.When you say "I wrote a program that crashed Windows", people just stare at you blankly and say "Hey, I got those with the system, *for free*".
-
08-31-2007, 05:37 AM #5Web Hosting Master
- Join Date
- Oct 2004
- Location
- Kerala, India
- Posts
- 4,771
Editing sql file is not recommended, as it can cause issues . Use the method foobic stated.
David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
CliffWebManager | Access WHM from iPhone and Android
-
08-31-2007, 03:47 PM #6
Upgrade SQL, don't downgrade your script. Mysql is in the 5.1 area now (beta), and php5 (which you'll need to upgrade to shortly) requires mysql >= 4.1.
Solution? Upgrade mysql to the current version, don't downgrade a script to an old, outdated one.Tom Whiting, WHMCS Guru extraordinaire
Linux problems? WHMCS Problems? Give me a shout
Check out my WHMCS Addons