Problems to Import a MYSQL file

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
silverme
Forum Newbie
Posts: 13
Joined: Tue Sep 27, 2005 4:24 pm

Problems to Import a MYSQL file

Post by silverme »

I was trying to load an old .sql file from the backup to read something deleted but had some trouble importing it.

Here's some info about the file:

File size: 17MB
MYSQL type database
-- phpMyAdmin SQL Dump
-- version 2.6.4-pl2
-- Host: localhost
-- Generation Time: Apr 21, 2006 at 09:36 PM
-- Server version: 4.1.18
-- PHP Version: 4.3.11


Here's some info about the server:

phpMyAdmin 2.6.3-1
MySQL 5.0.19-nt running on localhost as root@localhost
PHP Version 5.1.0


I tried to import the file with phpMyAdmin but it didn't work. I think it's because it has a 2MB maximum limit.

Then I went to the DOS console to use mysql but got an error.

c:\usr\local\mysql5\bin>mysql -u root -p database_name<tables.sql
Enter password: *******
ERROR 1406 (22001) at line 210: Data too long for column 'attachurl' at row 1


What should I do to import the .sql file?


Thank you
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: Problems to Import a MYSQL file

Post by volka »

silverme wrote:ERROR 1406 (22001) at line 210: Data too long for column 'attachurl' at row 1
Your table has a field attachurl and at least one INSERT operation tries to put too much data into it.
silverme
Forum Newbie
Posts: 13
Joined: Tue Sep 27, 2005 4:24 pm

Post by silverme »

What should I do to fix the problem? I'm trying to load all the tables from the backup to an empty database.

Thanks
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Post by iknownothing »

silverme wrote:What should I do to fix the problem? I'm trying to load all the tables from the backup to an empty database.

Thanks
check your attachurl attributes. Change to "text" or something similar perhaps...
rami
Forum Contributor
Posts: 217
Joined: Thu Sep 15, 2005 8:55 am

Post by rami »

NORMally phpmyadmin puts some kind of size restriction while uploading and downloadig the file..especially downloading...
so how to do that ...suppose my one table is 10mb how to download it using phpmyadmin..
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

At this point, you've probably got the database & tables created (due to those queries in the dump file being executed). Do you know if the dump file included table creation statements? If yes, then drop the database & edit the dump file - changing the offending column type to text or larger. If no, then do what ~iknownothing suggested & change the table definition in mysql. Drop the data, then re-import the file.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply