Search code examples
mysqlintellij-ideaphpstormjetbrains-ide

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?


Solution

  • 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.