Fehler 1170 beim Import eines Dumps

Alles, was MariaDB und MySQL betrifft, kann hier besprochen werden.

Fehler 1170 beim Import eines Dumps

Postby Tessi » 24. May 2006 13:16

Hallo,
Ich habe (wie fast alle hier) ein Problem mit dem Wiederherstellen eines Dumps einer meiner Datenbanken.
per
Code: Select all
mysqldump --quick -h HOST -u USER -pPW --quote-names --compress DB106779 > dbbackup/DB106779.sql

Habe ich den Dump erstellt und versuche ihn nun mit
Code: Select all
mysql -h HOST -u USER -pPW DB80998 < dbbackup/DB106779.sql

versuchsweise in eine leere Datenbank einzuspielen.

Dabei bekomme ich folgenden Fehler:
Code: Select all
ERROR 1170 (00000) at line 10: BLOB column 'text' used in key specification with out a key length


Der betreffende Teil aus dem Dump sieht wie folgt aus:
Code: Select all
#
# Table structure for table 'ToDo'
#
CREATE TABLE `ToDo` (
  `id` int(11) NOT NULL auto_increment,
  `text` text DEFAULT '' NOT NULL,
  `view` varchar(5) DEFAULT 'true' NOT NULL,
  `order` int(11) DEFAULT '0' NOT NULL,
  `done` int(11) DEFAULT '0' NOT NULL,
  `editor` varchar(45),
  PRIMARY KEY (id,id),
  KEY text (text)
);


Das bedeutet meinen Nachforschungen auf dev.mysql.com zufolge, dass MySql bemängelt, dass die 'text' Spalte als text angelegt wurde und so keine Längenangabe hat; die Längenangabe aber benötigt wird.
Mir war bisher nicht bekannt dass der Typ 'text' eine Längenangabe benötigt, weil er doch variabel lang sein soll. (Die Tabelle wurde damals per PhPMyAdmin erstellt und hat ihren Dienst auch erfüllt)
Ich frage mich nun wie ich den Fehler beheben kann, um später (im Notfall) sicher zu sein, dass ich ohne große Probleme mein Backup aufspielen kann.
Über eine Antwort würde ich mich sehr freuen,
MfG Philipp Tessenow

[edit]
Oh. Ich sehe gerade, das ich die Worte "key specification" überlesen habe. Also werde ich dem entsprechend mal versuchen den Key auf 'text' nicht zu setzen.
[/edit]

Ok nun besteht ebendies Problem immernoch mit einer Tabelle:
Code: Select all
ERROR 1170 (00000) at line 6361: BLOB column 'description' used in key specification without a key length

Der betreffende Teil der SQL-Datei:
Code: Select all
CREATE TABLE `mambo_downloads_files` (
  `id` int(11) NOT NULL auto_increment,
  `sequence` int(11) DEFAULT '0' NOT NULL,
  `windowtitle` varchar(255) DEFAULT '' NOT NULL,
  `realname` varchar(255) DEFAULT '' NOT NULL,
  `islocal` tinyint(3) unsigned DEFAULT '1' NOT NULL,
  `containerid` smallint(6) DEFAULT '0' NOT NULL,
  `filepath` varchar(255) DEFAULT '' NOT NULL,
  `filesize` varchar(255) DEFAULT '' NOT NULL,
  `filetype` varchar(255) DEFAULT '' NOT NULL,
  `filetitle` varchar(255) DEFAULT '' NOT NULL,
  `description` text DEFAULT '' NOT NULL,
  `smalldesc` text DEFAULT '' NOT NULL,
  `autoshort` tinyint(3) unsigned DEFAULT '1' NOT NULL,
  `license` text DEFAULT '' NOT NULL,
  `licenseagree` tinyint(3) unsigned DEFAULT '0' NOT NULL,
  `price` int(11) DEFAULT '0' NOT NULL,
  `currency` char(3) DEFAULT '' NOT NULL,
  `downloads` int(11) DEFAULT '0' NOT NULL,
  `url` varchar(255) DEFAULT '' NOT NULL,
  `icon` varchar(50) DEFAULT '' NOT NULL,
  `published` tinyint(3) unsigned DEFAULT '1' NOT NULL,
  `registered` tinyint(3) unsigned DEFAULT '2' NOT NULL,
  `userupload` tinyint(3) unsigned DEFAULT '3' NOT NULL,
  `recommended` tinyint(3) unsigned DEFAULT '0' NOT NULL,
  `recommend_text` text DEFAULT '' NOT NULL,
  `featured` tinyint(4) DEFAULT '0' NOT NULL,
  `featured_st_date` date DEFAULT '2000-01-01' NOT NULL,
  `featured_end_date` date DEFAULT '2000-01-01' NOT NULL,
  `featured_priority` smallint(6) DEFAULT '0' NOT NULL,
  `featured_seq` smallint(6) DEFAULT '0' NOT NULL,
  `featured_text` text DEFAULT '' NOT NULL,
  `opsystem` varchar(50) DEFAULT '' NOT NULL,
  `legaltype` varchar(50) DEFAULT '' NOT NULL,
  `requirements` text DEFAULT '' NOT NULL,
  `company` varchar(255) DEFAULT '' NOT NULL,
  `releasedate` date DEFAULT '1000-01-01' NOT NULL,
  `languages` text DEFAULT '' NOT NULL,
  `company_URL` varchar(255) DEFAULT '' NOT NULL,
  `translator` varchar(255) DEFAULT '' NOT NULL,
  `fileversion` varchar(50) DEFAULT '' NOT NULL,
  `fileauthor` varchar(100) DEFAULT '' NOT NULL,
  `author_URL` varchar(255) DEFAULT '' NOT NULL,
  `filedate` datetime DEFAULT '2000-01-01 00:00:00' NOT NULL,
  `filehomepage` varchar(255) DEFAULT '' NOT NULL,
  `screenurl` varchar(255) DEFAULT '' NOT NULL,
  `plaintext` tinyint(3) unsigned DEFAULT '0' NOT NULL,
  `isblob` tinyint(3) unsigned DEFAULT '0' NOT NULL,
  `groupid` smallint(6) DEFAULT '0' NOT NULL,
  `submittedby` mediumint(9) DEFAULT '0' NOT NULL,
  `submitdate` datetime DEFAULT '2000-01-01 00:00:00' NOT NULL,
  UNIQUE id (id),
  KEY filetitle (filetitle),
  KEY realname (realname),
  KEY url (url),
  KEY containerid (containerid,published),
  KEY recommended (containerid,recommended,published),
  KEY featured (containerid,featured,published,featured_st_date,featured_end_date),
  KEY opsystem (containerid,opsystem,published),
  KEY filetitle_2 (filetitle,description,smalldesc,fileauthor)
);

Der Spaß an der Geschichte ist nun natürlich, dass das ein Joomla Table ist (heißt nur aus historischen Gründen noch Mambo). Und ich schätze, dass sich die Joomla-Entwickler schon was beim setzen der Indizes gedacht haben (mehr als das bei dem Table oben, den ich selbst erstellt hatte, war).
Also kommt die Lösung mit dem Löschen des Key-Eintrags nun für mich nicht in Frage.
Gibt es eine andere Lösung?
MfG, P. Tessenow
Tessi
 
Posts: 16
Joined: 24. May 2006 12:52
Location: Berlin, Germany

Postby sari42 » 28. May 2006 22:05

hast du 's mal mit phpmyadmin versucht?
klappt bei mir immer, auch übers netz mit gzip
(auch gutes backup!)

btw. PRIMARY KEY (id,id), sieht komisch aus,
PRIMARY KEY id(id) ?

pma ergibt:
Code: Select all
--
-- Tabellenstruktur für Tabelle `te`
--

CREATE TABLE `te` (
  `1` text NOT NULL,
  `2` text NOT NULL,
  `3` text NOT NULL,
  `4` text NOT NULL,
  `5` text NOT NULL,
  `a` varchar(255) NOT NULL,
  `b` varchar(255) NOT NULL,
  `ts` timestamp NOT NULL default '0000-00-00 00:00:00' on update CURRENT_TIMESTAMP,
  KEY `a` (`a`,`b`),
  FULLTEXT KEY `1` (`1`,`2`,`3`,`4`,`5`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Daten für Tabelle `te`
--

INSERT INTO `te` (`1`, `2`, `3`, `4`, `5`, `a`, `b`, `ts`) VALUES ('text1', 'text2', 'text3', 't e x t 4', 'text\r\n5', 'aaaa', 'bbbb', '2006-05-24 20:00:00');
sari42
 
Posts: 800
Joined: 27. November 2005 18:28

Postby nullplan » 29. May 2006 10:26

Idee: Quäle doch mal die Ersetzen-Funktion deines Editors und schreibe:
Ersetze 'text' auf jeder Zeile auf der ganzen Zeile durch 'text(10240)', wobei text ein ganzes Wort sein muss. Um mit Vim zu sprechen:
Code: Select all
:%s/\<text\>/text(10240)

10 KB sollten für den Text ausreichen.
Tschö,
nullplan
Lernen ohne zu denken ist sinnlos, aber denken ohne zu lernen ist gefährlich. - Konfuzius
nullplan
 
Posts: 22
Joined: 14. May 2006 10:19

Postby sari42 » 30. May 2006 00:09

text(10240) ist nicht nötig, statt

KEY filetitle_2 (filetitle,description,smalldesc,fileauthor)

FULLTEXT KEY filetitle_2 (filetitle,description,smalldesc,fileauthor)

dann gehts (in phpmyadmin getestet,MySQL - 5.0.21) !
sari42
 
Posts: 800
Joined: 27. November 2005 18:28

Postby Tessi » 30. May 2006 09:24

Ich danke euch für die Antworten!
Code: Select all
[...] statt
KEY filetitle_2 (filetitle,description,smalldesc,fileauthor)
FULLTEXT KEY filetitle_2 (filetitle,description,smalldesc,fileauthor)
dann gehts (in phpmyadmin getestet,MySQL - 5.0.21) !

(Sollte das Mysqldump Programm das nicht schon von natur aus so machen? Immerhin haben das ja die Datenbankentwickler selbst geschrieben)

Ausprobieren werde ich es später. Ich muss gleich zur mündlichen Abiprüfung (Wirtschaft) und guck hier nur noch mal rein, um meine Nerven zu beruhigen und mich abzulenken =)
Ohne Werbung machen zu wollen, schaut mal hier rein: http://www.apachefriends.org/f/viewtopic.php?t=18155 . ich würde mich sehr über eine Antwort freuen.
Tessi
 
Posts: 16
Joined: 24. May 2006 12:52
Location: Berlin, Germany


Return to MariaDB - MySQL

Who is online

Users browsing this forum: No registered users and 15 guests