Troubleshooting of MySQL errors: Difference between revisions

Jump to navigation Jump to search
Line 219: Line 219:
* If you are using the console command, escape the password if it contains special characters e.g. {{kbd | key=<nowiki>mysql -u root -p'PASSWORD'</nowiki>}}<ref>[http://superuser.com/questions/123928/escaping-a-password-using-mysqldump-console escape characters - Escaping a password using mysqldump console - Super User]</ref>
* If you are using the console command, escape the password if it contains special characters e.g. {{kbd | key=<nowiki>mysql -u root -p'PASSWORD'</nowiki>}}<ref>[http://superuser.com/questions/123928/escaping-a-password-using-mysqldump-console escape characters - Escaping a password using mysqldump console - Super User]</ref>
* You may need to delete the existing account setting and re-config again.
* You may need to delete the existing account setting and re-config again.
=== ERROR 1827 (HY000): The password hash doesn't have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function. ===
Wrong sql query as follows:
<pre>
CREATE USER 'test'@'localhost' IDENTIFIED BY PASSWORD 'my_password';
</pre>
Solution:
(1) Check if the account was created or not
<pre>
SELECT User,Host FROM mysql.user;
</pre>
(2a) If the account was created, set the password for the account.
<pre>
SET PASSWORD FOR 'test'@'localhost' = PASSWORD('my_password');
</pre>
(2b) If the account was NOT created, re-create the account.
<pre>
CREATE USER 'test'@'localhost' IDENTIFIED BY 'my_password';
</pre>
references
* [http://dev.mysql.com/doc/refman/5.7/en/create-user.html MySQL :: MySQL 5.7 Reference Manual :: 14.7.1.2 CREATE USER Syntax]
* [http://dev.mysql.com/doc/refman/5.7/en/set-password.html MySQL :: MySQL 5.7 Reference Manual :: 14.7.1.7 SET PASSWORD Syntax]
* [http://dev.mysql.com/doc/refman/5.7/en/drop-user.html MySQL :: MySQL 5.7 Reference Manual :: 14.7.1.3 DROP USER Syntax]


== SQL and Query Errors ==
== SQL and Query Errors ==

Navigation menu