So I have been trying to upload this csv into mysql workbench by first creating a schema then right clicking the schema and using table import wizard. This however has taken such a long time to import I have left my computer running for hours and it is still not close to being uploaded. Wondering if anyone has any tips? I tried the LOAD DATA statement but am getting a "mysql is running with a secure-file-priv option" error. Thanks!
Related
I am attempting to import a text file into a table on MySQL workbench. When I run my 'LOAD DATA INFILE' command, I get this error
Error 120- mysql server is running with the secure-file-priv option
When I looked it up, from what I understood, there's a specific directory from which I can import text files and if the file is outside of this directory, then I'll be getting this error. I figured I look up an answer online, and most people suggested that I run this command
"SHOW VARIABLES LIKE "secure_file_priv".
The problem is, whenever I attempt to run this command, my MySQL tab 'quits unexpectedly'.... wow, just wow. So now Im stuck not being able to find which directory must be used for text files. Any help would be really appreciated.
This is how the error happened - I was using MySQL shell to import a 16G .sql file that contains multiple tables using the source command and optimizations (as the first solution in this question, with maximum values indicated in MySQL documentation). The import seem to have gone on for a while, and then I got ERROR 2006: Server has gone away when I checked it after three days. It seems to have happened in the middle of inserting rows into a table that already has hundreds and thousands of rows inserted.
I restarted the server, want to pick up where the import has left off so I don't have to duplicate all the work and possibly run into the same problem, and got stuck trying the following options -
Finding where the problem is through logs. Since I haven't initiated error logs (reference here), I looked for binary logs. The SHOW BINARY LOGS command shows a list logs as the documentation says it would, but I couldn't view the logs themselves, so I can't figure out where it's gone wrong.
Insert-ignore - I have tried the first and second solutions to this question import mysql data interrupted, how to resume? but kept getting syntax error when I tried to reference the full path to the .sql file, which is on an external drive.
Look for an insert-ignore option that works with the source command, with which I've imported several smaller large .sql files, but so far haven't found it.
Run snippets of the .sql file using MySQL WorkBench - it was unresponsive for a few hours and eventually loaded a blank window. I also tried opening the .sql file using NotePad, ATOM and Sublime, they all haven't loaded.
My last resort would be to break up the .sql file into snippets, and then copy and paste potentially hundreds of statements into MySQL shell, but I'm hoping that I don't have to go there.
Any suggestions?I'm using MySQL community version 8.0...and also I am a SQL newbie so might be missing something really obvious. Thanks in advance!
EDIT -
On 2)- Figured out how the syntax works with full path in INSERT-IGNORE after rereading documentation of the query. But then the LOAD DATA command has directory and also unique key constraints which I might not be able to satisfy.
I am new to mySql workbench and need help importing a large file for analysis. I read here
MySQL workbench table data import wizard extremely slow that the data import wizard shouldn't be used so i used LOAD DATA INFILE as suggested but I had issues importing due to secure_file_priv=NULL.
I found a solution here How should I tackle --secure-file-priv in MySQL? but I don't know how to reset the value of secure_file_priv.
I found some sources that use command line to do so but I don't know how to use mySql workbench from command line.
Any help on how to disable this or change it would be appreciated
don't touch it, it is basicakky a security feature.
use the data import under server in workbench,
If you want do it by sql, ecery thng os written already in How should I tackle --secure-file-priv in MySQL? which you linked
simple
copy your file in the folder, that you get as value, when you do a SHOW VARIABLES LIKE "secure_file_priv";
Now you can make a LOAD DAT ideally from the console, because then you have no timeout.
Read also Bulk insert in the namual so that you can optimize a big data import
If you really want to use any folder which is not recommended, you have to edit the my.ini file for that and restart to server (both can be done in Workbench as well, you see in the picture options file and Start/shutdown.) There are some other ways do restart the service.
Here are the basics good described of importing csv
I currently have a massive excel file of which the data i'd like to import it into my already setup MySQL Server and Table
I have MySQL Administrator installed, so I was wondering if MySQL Admin can import excel files to SQL tables or if I should install another program to do what I want?
Thanks.
I found this: http://www.aspfree.com/c/a/Database/Converting-Your-Excel-Worksheet-into-a-Working-MySQL-Database/ and it worked perfectly fine
I have data in a table A on my prod server. I want to move the data in it into table A (same name) on my test server.
What is the simple way to do this without exporting the data into some file and then inserting into my test table?
Thanks. I Looked around S/O and couldnt find a satisfactory answer.
If you have a tool like SqlYog, it's pretty simple with a couple of clicks of the mouse, otherwise you cannot do it because a query works in the context of a db connection, and for different servers you need different connections.
If you have phpmyadmin installed on both servers do the follwing
go to the table in phpmyadmin on your prod server
click export and export as .sql
go to the table in phpmyadmin on your test server
click import and upload the .sql file
If your database is more than 8 mb you can always compress it