hdew
hdew

Reputation: 33

MySQL 5.1: Check MySQL server version for the right syntax to use near 'USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password''

I am trying to create a MySQL user on a Solaris server. here is the command I am using:

ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

But I recevied the following error.

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 'USER 'admin'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'' at line 1

What am I get this?

Thanks in advance

Upvotes: 1

Views: 788

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562871

ALTER USER was introduced in MySQL 5.6, which has been generally available since 2013. This statement is not supported in older versions of MySQL.

You can create a user with the CREATE USER statement. In fact, that's the correct statement even in current versions of MySQL. I'm not sure why you're trying to use ALTER USER if you want to create a new user.

If you want to change the password for an existing user, use the SET PASSWORD statement.

Really, you should just upgrade. The version of MySQL you are using passed its end-of-life in 2013.

Upvotes: 1

Related Questions