Search code examples
mysqlmysql-workbenchmysql-pythonmysql-error-1064

How to resolve "used command not allowed" in MySQL?


This post isn't duplicate. I already referred this post and this post but the answers doesn't help

I am trying to execute a code in mySQL client window. HowEVER,I get the below error

The used command is not allowed with this MySQL version

What I did

SET GLOBAL local_infile = 1;
SHOW VARIABLES LIKE 'local_infile';

enter image description here

I executed the above commands in MySQL 8.0 Command Line Client

When I tried to do the same thing in MySQL Shell, I get the below error as Unexpected identifier

enter image description here

I am assuming MySQL Shell is the server. Do we have to do this at both client and server side?

How do I resolve this? In addition, whenever I launch command line client, I am only prompted to type password. So I am not able to pass it as a parameter. my clinet looks like as shown below

enter image description here

But how do I pass the below parameters while logging in then?

mysql -u abcd -p password_here --local-infile=1

I am new to MySQL and can you guide me?


Solution

  • Q1:

    To run sql commands in MySQL Shell you need to change from default JS to sql

    R1:

    type \sql to change from js to sql
    mysql-js> \sql

    Q2: so I am not able to pass it as a parameter

    For this you must be selecting 'MySQL x.x Command Line Client' under windows search.

    To resolve you need to have mysql bin folder in environment path or do the below step to access

    R2:

    Goto "C:\Program Files\MySQL\MySQL Server x.x\bin" this is windows default path unless you change.

    Then in the address bar if you click it will select ( i.e. C:\Program Files\MySQL\MySQL Server 5.7\bin) there just type cmd (Note: now in the address bar you will see only cmd) then press enter.

    Once cmd window opens with the mysql path like below

    C:\Program Files\MySQL\MySQL Server 5.7\bin>

    Type blah..blah.. blah

    mysql -u abcd -p password_here --local-infile=1

    Note: If you just parse -p instead of -ppassword it will ask for password after that. So if you are going to type the password directly then type -pyourpass there will not be any spaces between -p and password