Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting data to MySQL from file (csv, sql) in PhpStorm

My situation is as follows. I have a remote database, which i can only access via ssh-tunnel. I promptly configured it as a Data Source in PHPStorm and everything works fine. However, i often need to operate moderately large tables (several millions of records), so simply copy-pasting INSERT statements to add data doesn't work.

I tried googling it, search PhpStorm Help, but there is no info at all. Perhaps, some plugin exists for such task, or is there another way of inserting data from files via PHPStorm?

like image 932
Eternal1 Avatar asked Dec 04 '14 11:12

Eternal1


2 Answers

Add the sql file to your project files, right-click this file in the Project view and select "Run {filename}" You will then be asked to select the right database, on which the sql will execute.

like image 163
veelen Avatar answered Oct 14 '22 08:10

veelen


Step by step guide to execute Mysql Script from PhpStrom or any Jet Brain's intelligence IDE

1.Put your MySQL script file in current project directory.

2.Right click and select option Run_{fileName.sql} from Context menu (Tip: you can also select multiple files if you want.)

enter image description here

3.Select appropriate Schema/database name in Target data source/Schema

enter image description here

4.click on Run button. After that execution of operations will going to start.

like image 29
dipenparmar12 Avatar answered Oct 14 '22 10:10

dipenparmar12