I’m converting a SQLite database to MySQL so I can import it to PHPMyAdmin.
This should be straightforward. I exported it to a dump, changed the autoincrements and changed all double quotes to backticks. This is what the start of the resulting file looks like:
DROP TABLE IF EXISTS `chars`;
CREATE TABLE chars(
charid INTEGER PRIMARY KEY AUTO_INCREMENT,
character TEXT
);
INSERT INTO `chars` VALUES(3,'a');
INSERT INTO `chars` VALUES(4,'b');
…
When trying to import to PHPMyAdmin it throws this error.
Error SQL query: CREATE TABLE chars( charid INTEGER PRIMARY KEY AUTO_INCREMENT , CHARACTER TEXT ); MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'character TEXT )' at line 3
Is there too much space after the indented line? I left the “format” option as “SQL”, left SQL compatibility mode as NONE and left “Do not use AUTO_INCREMENT for zero values” ticked.
Its going to be used in a django web app.
CHARACTERis a reserved word in mySQL. I’m betting that is the reason.Use either a different column name (preferred), or use backticks: