Import csv into MYSQL DB with Windows Powershell

  • Hello guys,

    I'm trying to import my csv with a cmdlet into my MYSQL DB. Bit I have issues with connecting to my db cause there is no options to use a user and password.

     

    The MYSQL server is running localy on the same machine.

    This is my code:

    Write-SqlTableData -DatabaseName DashboardData -TableName akustik -Serverinstance $env:COMPUTERNAME -SchemaName dashboard -InputData $data -Passthru

    and it throws this error:

    Write-SqlTableData : Fehler beim Herstellen einer Verbindung mit dem Server "VERWALTUNG-MA".

    In Zeile:1 Zeichen:1

    + Write-SqlTableData -DatabaseName dashboard -TableName akustik -Server ...

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo : ObjectNotFound: (VERWALTUNG-MA:String) [Write-SqlTableData], ConnectionFailureException

    + FullyQualifiedErrorId : ConnectionToServerFailed,Microsoft.SqlServer.Management.PowerShell.WriteSqlTableData

     

    Would be glad if someone could help me cause i havnt much experience with powershell.

    Thanks in advance.

    Greetings LittleStudent

  • Hello and welcome to the forum.

    As this is purely a SQL Server forum, you may find that you would get more help by posting in a MySQL forum instead.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Write-SqlTableData is for Microsoft SQL Server only.  You cannot run that function against MySQL

     

    As Phil said a dedicated MySQL forum would be best here and maybe looking at the module MySQLCmdlets.

  • My recommendation would be to start at the following URL...

    https://duckduckgo.com/?q=import+csv+into+mysql+workbench

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Okay thank you very much guys. Meanwhile i resolved it by myself.

    Thank you very much for your fast respponse guys :).

    Greeting LittleStudent

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply