sql-parser icon indicating copy to clipboard operation
sql-parser copied to clipboard

Missing comma before start of a new alter operation. (near "BY" at position 68) and Unrecognized alter operation. (near "BY" at position 68)

Open soumya1810 opened this issue 3 years ago • 4 comments

sql query written:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourRootPassword';
-- then
FLUSH PRIVILEGES;

soumya1810 avatar Oct 29 '20 09:10 soumya1810

same problem, is there no other way ??

rounak-dev avatar Jul 13 '21 07:07 rounak-dev

same problem, is there no other way ??

Are you using phpMyAdmin or the parser directly?

williamdes avatar Jul 13 '21 10:07 williamdes

I am getting this same error, can you help? MYSQL error

kipio avatar Oct 01 '21 04:10 kipio

I managed to change the password of a user with the following query:

SET PASSWORD FOR 'root'@'localhost' = 'magento2';

Reference: https://dev.mysql.com/doc/refman/8.0/en/set-password.html

But still I would like to know why it is showing error for the statement: ALTER USER 'root'@'localhost' IDENTIFIED BY 'magento2';

kipio avatar Oct 01 '21 04:10 kipio

@williamdes , is there any chance for you to test phpMyAdmin with the incoming sql-parser 5.8 please?

Using this version of the parser, do you still have the error please? I wonder if this MR didn't fix this issue.

Tithugues avatar Apr 12 '23 12:04 Tithugues

Well, I used the CLI and it seems like not

echo 'ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourRootPassword';
-- then
FLUSH PRIVILEGES;' | ./bin/lint-query
#1: Virgule manquante avant le début d’une nouvelle opération ALTER. (near "BY" at position 64)
#2: Opération ALTER non reconnue. (near "BY" at position 64)

williamdes avatar Apr 14 '23 15:04 williamdes

I don't know if you were running that on an non-rebased branch or something, but I just run that command on master branch today:

php ./bin/lint-query --query "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourRootPassword';
-- then
FLUSH PRIVILEGES;"

and everything worked like a charm.

@williamdes Can you double check that being sure you're on the latest version?

niconoe- avatar Jun 21 '23 14:06 niconoe-

I don't know if you were running that on an non-rebased branch or something, but I just run that command on master branch today:

php ./bin/lint-query --query "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourRootPassword';
-- then
FLUSH PRIVILEGES;"

and everything worked like a charm.

@williamdes Can you double check that being sure you're on the latest version?

This command outputs nothing on 5.x and 6.x What does it throw on your end ?

williamdes avatar Jun 22 '23 08:06 williamdes

It output nothing neither on my side, which means there are no parsing error, which is the expected behavior. The query, and thoses statements, are correct.

niconoe- avatar Jun 22 '23 09:06 niconoe-

I think it's now fixed @soumya1810 could you confirm with the latest 5.2 version in development (phpMyAdmin 5.2+snapshot) also available as a non official docker image ?

williamdes avatar Jun 22 '23 09:06 williamdes