none
HELP me with my script please RRS feed

  • Question

  • I Have been trying to  run a powershell command to flush host in my sql  what am doing wrong:

    cd "c:\Program Files\mysql\mysql server 8.0\bin"
    .\mysql -u root -p -h localhost


    [void][system.reflection.Assembly]::LoadFrom("C:\Program Files (x86)\MySQL\MySQL Connector Net 8.0.17\Assemblies\v4.5.2\mysql.data.dll")
    $myconnection = New-Object MySql.Data.MySqlClient.MySqlConnection
    $myconnection.ConnectionString = "database=test;server=localhost;Persist Security Info=false;user id=root;pwd="
    Execute-MySQLQuery flush hosts;



    • Edited by RobMHS Friday, August 9, 2019 1:08 PM
    Friday, August 9, 2019 1:06 PM

All replies

  • Which statement fails? What is the error?
    Friday, August 9, 2019 1:11 PM
  • This is what i get after i run it:

    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 919
    Server version: 8.0.17 MySQL Community Server - GPL

    Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql>

    

    

    Friday, August 9, 2019 1:45 PM
  • Start by reading the help for MySQL.

    MySQL /h

    This is not a MySQL forum. I recommend that you post in a MySQL forum for help with using MySQL tools.


    \_(ツ)_/


    • Edited by jrv Friday, August 9, 2019 1:50 PM
    Friday, August 9, 2019 1:49 PM
  • This is what i get after i run it:

    

    I don't see any error. Looks like you just launched an interactive instance of MySQL.

    If you have one script that launches MySQL and then calls it with Powershell commands, that will not work because you have to exit MySQL to get the script to move on to the next command. But those command will then fail because you shut down MySQL. 

    Open 2 Powershell windows. Run MySQL in one, and the script that executes the flush in the other window.   

     
    • Edited by MotoX80 Friday, August 9, 2019 7:55 PM
    Friday, August 9, 2019 2:43 PM