Error executing PASSWORD IN MYSQL SERVER function ( ERROR 1064 SQL SYNTAX)

Asked

Viewed 425 times

1

Error while executing function PASSWORD IN MYSQL SERVE

I have the following query:

SELECT * 
FROM users 
WHERE login = 'FABIO' 
  AND pwd = PASSWORD('2018') 
LIMIT 0, 50000

You’re making that mistake:

Error Code: 1064. You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near

  • See what FABIO is between simple quotes, password also has to be also.

  • @The password and function cannot be enclosed in a single quote. The query is correct.

  • Fabio, when you said that the password has to be in simple quotes was a tip. The query that is coming into the bank is not correct. You have to write something like this: "SELECT * from usuarios Where login = 'FABIO' and pwd = '" + PASSWORD('2018') + "' LIMIT 0, 50000 " so that the query that arrives at the bank arrives correctly.

  • @In this case, concatenation is not necessary since the function is native to Mysql. I think it would be some kind of wrong configuration on my Mysql Server, because on another server a query identical to this one works and brings the correct result.

  • Let’s say the PASSWORD function is returning 123. Do the select like this: SELECT * from usuarios Where login = 'FABIO' and pwd = '123' LIMIT 0, 50000

  • @Reginaldo works there behind the results. The problem is when I put the PASSWORD function.

  • You have to mount your select so that you put the quotes in the return of the function. Or make the function already return the value between quotes.

  • @Reginaldorigo as reported earlier, in this case, concatenation is not necessary since the function is native to Mysql. I think it would be some kind of wrong configuration on my Mysql Server, because on another server a query identical to this one works and brings the correct result.

  • @Reginaldorigo after a look at Guilherme’s reply.

Show 4 more comments

1 answer

1


  • That’s right William, pity you stopped using I’ll start using another function thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.