I am trying to import data from pipe delimited file to mysql. Creating the table works. However, when i try to import data i get this error "ERROR 1467 (HY000): Failed to read auto-increment value from storage engine". I have checked on website for possible errors but any answers. Below is the script I am using. I am quite new to MySql.
SELECT 'Changing database..' as '';
use test
SELECT 'Droing table if it exists' as '';
DROP TABLE IF EXISTS table1;
CREATE TABLE IF NOT EXISTS table1
(
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
infohash VARCHAR(100) NOT NULL,
categories VARCHAR(100) DEFAULT NULL,
info_url VARCHAR(300) NOT NULL,
download_url VARCHAR(300) DEFAULT NULL,
PRIMARY KEY (id)
);
SHOW TABLES;
LOAD DATA INFILE '/usr/Software/sample.txt'
INTO TABLE table1
CHARACTER SET utf8
COLUMNS
TERMINATED BY '|'
LINES
TERMINATED BY '\n'
;
SELECT 'Total rows in table' as '';
select count(*) from table1;
Here is the output i am getting.
mysql> source table_creattion.sql
+---------------------+
| |
+---------------------+
| Changing database.. |
+---------------------+
1 row in set (0.00 sec)
Database changed
+---------------------------+
| |
+---------------------------+
| Droing table if it exists |
+---------------------------+
1 row in set (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
+----------------+
| Tables_in_test |
+----------------+
| table1 |
+----------------+
1 row in set (0.00 sec)
ERROR 1467 (HY000): Failed to read auto-increment value from storage engine
+---------------------+
| |
+---------------------+
| Total rows in table |
+---------------------+
1 row in set (0.00 sec)
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (0.00 sec)
I am not sure why this error is coming. Anyone?