PHPMyadmin import CSV creates new table - mysql

I am trying to import some data into a MySQL 5.5.31 table from a CSV file using PHPMyadmin 4.0.0.
When I try to import, the import "works" but it creates a new table rather than imports into the current table - the new table is assigned a sequential name by PHPMyadmin and, whilst the data is viewable, the data is not usable as the table does not contain a unique column.
Here is a screenshot of the settings I am using to import which also shows I am trying to import into the table:
And here is the result I get from PHPMyadmin:
Any idea why this is happening? I have tried searching for the "The following structures have either been created or altered" message but found nothing here and only a few things on Google but none of the Google responses were of any help.

Not allowed to comment on Madhura Jayaratne's reply, but - because people trying to import ODS will look at this thread - it is worth pointing out that it is only partly correct. CSV has been fixed but the same bug still exists for ODS in phpMyAdmin 4.0.5.

This is a bug in phpMyAdmin and it has been fixed since version 4.0.1. See 14 item under 4.0.1.0 (2013-05-14) section of the change log file. Upgrade to 4.0.1 or a version greater than that.

Instead of phpmyadmin try SqlYog .SqlYog is userfriendly.Just try it

Related

MySQL Workbench Import NULL from CSV

I can't for the life of me make MySQL Workbench import NULL for blank cells in a CSV.
I've tried:
blank
NULL
\N
Each with and without ""
How the does one signify a cell is 'null' inside a CSV file I want to import into MySQL via Workbench?
Since MySQL Workbench version 8.0.16 (released on 04/25/2019) there has been an additional option for uploading .csv file -- "null and NULL word as SQL keyword". When selecting this option as YES, the NULL expression without quotes in .csv file (,NULL, rather than ,"NULL",) will work for this purpose.
You can solve your problem by updating your workbench to the newest.
If you were trying to import a CSV into the model for creating insert scripts (where you won't get the same options described in the other answers), try the following:
\func NULL
You can also use this syntax to call functions like the following to insert the current date time when you forward engineer the model to the database:
\func CURRENT_TIMESTAMP
I suggest switching to Navicat for MySQL -- if only for the csv table import wizard. After repeated attempts to get the MySQLWorkbench Import Wizard to work for my CSV file, I gave up. I recalled using Navicat in an early project and it worked flawlessly. For this import, I was able to load my 15000+ row CSV with multiple null datetime values into my MySQL table without a problem.
Weird that MySQLWorkbench still hasn't solved this annoyance. But Navicat provides an easy alternative until they do.

import sql file asreplace with phpmyadmin

How can I import a SQL-file (yes, sql not csv) with phpmyadmin so that it replaces or updates the data while importing?
I did not find option for that. I also created another temporary database where I imported the sql-file in question (having only INSERT -lines, only data no structure), and then went to export to select suitable option like INSERT ... SELECT ... ON DUPLICATE KEY UPDATE ..but did not find one or anything that would help in the situation.
So how can I achieve that? If not with phpMyAdmin, is there a program that transforms "insert" sql file to "update on duplicate", or even from "insert" to "delete" after which I could then re-import with original file?
How I came to this, if it helps the above or if someone has better solutions to previous steps:
I have a semi-large (1 GB) DB file to import, which I have then divided to multiple smaller files to get it imported. One of them being the structuce sql-dump and rest the data. When still trying to get the large file through, trying to adjust timeout settings through htaccess or phpmyadmin import options did not help - always getting the timeout anyway. Since those did not work, I found a program by Janos Rusiczki (https://rusiczki.net/2007/01/24/sql-dump-file-splitter/) to split the sql file into smaller ones (good program thanks Janos!). It also separated the structure from the data.
However after 8 succesfull imports I got timeout again, after phpmyadmin already imported part of the file. Thus I ended up in current situation. I know, I can always delete all and start over with even smaller partial files, but.. I am sure there is a better way to do this. There has to be a way to replace the files on import, or do some other way described above.
Thanks for any help! :)
Cribbing from INSERT ... ON DUPLICATE KEY (do nothing), you can use a regular expression to make every INSERT into an INSERT IGNORE in your sql file and it will pass over all the entries that have already been imported.
Note that will also ignore other errors, but other than timeout errors don't seem likely in this context.

Import MySQL file into Oracle SQL Developer

I have tried to find an answer for this elsewhere but cannot, I hope someone can help me.
I am trying to import the MySQL sample database into Oracle SQL Developer.
I have an existing database/connection I want to dump it into. I have created an empty table named classicmodels in my existing connection. Yes that name is only 1 table within the sample db, correct. Ignore the error in naming convention.
When I R-click on it and try 'import data' I cannot import a .sql file, I can only do it with XL, CSV, etc.
When I try and run a script it found on dba.stackexchange
#\path\mysqlsampledatabase.sql , I get a series of 'please provide substitution value' messages, which does not make sense to me given that I am importing a database which is built for SQL (ie what reason is there to substitute).
Pictures below:
The 'UnseenCollection' is a single table I imported as a csv file. I need to import the mysqlsampledatabase file such that it shows up the same way, I can access all tables within the sample db.
Anyone can help I would appreciate it. I need the end result to be the entire mysqlsampledatabase to populate within the 'classicmodels' node.
Thank you.
connect to MySQL
connect to Oracle
for a single MySQL table, right-click, 'Copy to Oracle'
for a few tables, select, drag and drop onto Oracle connection (requires newer version of SQL Developer)
for an entire MySQL database, use the migration project feature

MySQL now allow data to be imported by phpMyAdmin

I have just ended up creating Django website and now using phpMyAdmin I am importing large data sets in my mode. However, it appears that there is something wrong with the column values which I am trying to import via phpMyAdmin. I see the following error:
#1366 - Incorrect string value: '\x93Desig...' for column 'sku_description' at row 1
If it was one or two columns I could've manually fixed it. However, as I mentioned there is tons of data in there. What would be the most practical solution for this problem?
Nevermind. I solved it by changing the encoding in excel.
In Excel 2010, save file as CSV and before clicking save, click on Tools->Web Options->Encoding->Unicode(Utf8) and save it. Now import it into MySQL via phpMyAdmin.

Importing partial data into MySQL from CSV

I have a CSV that is a partial projection of an origin table. I have the same table structure in my DB.
I would like to import only those columns into my DB, given that no additional NOT NULL constraints are in place (I explicitly disabled some of them). I don't know how to import them.
I have tried the following: from MySQL Workbench, right click on table and then Edit table data, then on the screen I tried the "Import records from an external file" button, loaded the CSV file but I got the following error:
[Window Title]
MySQL Workbench
[Main Instruction]
Error importing recordset
[Content]
error calling Python module function SQLIDEUtils.importRecordsetDataFromFile
[OK]
The column names are the same as in the DB but these are partial (not all columns as DB). The table is currently empty.
What can I do to import the data into MySQL?
It turns out that is the error that tool gives for ANY problems importing CSV data. They have opened a bug for more descriptive error responses.
For me it turned out that it can not work with non-Windows line breaks. So if your file came from Unix/Linux or Mac it will not work. You can just open it in Excel though and re-save it as an MS-DOS CSV and then it works. Other things that can make it throw up are any use of ";".
Also the tool has NO column mapping options so you have to have your import file matched to the table setup perfectly. If you have columns mis-matched or data types mis-matched it will also throw-up.
I got the same question and error when I was importing a csv file into MAC Mysqlworkbench.
I restored my file as windows comma separated (.csv). This works for me.
Check do you have permissions to import (on insert), and if you import clearing old data check do you have permissions on delete.
If it won't help, create a new table with least restrictions which has absolutely identical columns as in CSV file, try to import to it. If ok - just update/insert into your target table
If it won't help, try to import on another database.
If it won't help, check CSV file - is all contents is ok? (may be it should try first)