[MDEV-16716] syntax error with "create user .. identified via" Created: 2018-07-10  Updated: 2018-07-10  Resolved: 2018-07-10

Status: Closed
Project: MariaDB Server
Component/s: Admin statements, Documentation, Server
Affects Version/s: 10.3.8
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Philippe Kueck Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

CentOS 7.5.1804



 Description   

Hi,

I'd like to create a new user using the syntax stated in the knowledge base, but all I get is a syntax error:

show plugins;
-- +-------------------------------+----------+--------------------+---------+---------+
-- | Name                          | Status   | Type               | Library | License |
-- +-------------------------------+----------+--------------------+---------+---------+
-- | binlog                        | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
-- | mysql_native_password         | ACTIVE   | AUTHENTICATION     | NULL    | GPL     |
-- | mysql_old_password            | ACTIVE   | AUTHENTICATION     | NULL    | GPL     |
-- | ...
create user 'someone'@'localhost' identified via 'mysql_native_password' by 'foo';
-- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'by 'foo'' at line 1
create user 'someone'@'localhost' identified via 'mysql_native_password' as 'foo';
-- ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
select password("foo");
-- +-------------------------------------------+
-- | password("foo")                           |
-- +-------------------------------------------+
-- | *F3A2A51A9B0F2BE2468926B4132313728C250DBF |
-- +-------------------------------------------+
create user 'someone'@'localhost' identified via 'mysql_native_password' as password('foo');
-- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'password('foo')' at line 1

Same results for VIA/WITH, BY/AS/USING, having the authentication plugin either with or without quotation marks.
A possible workaround is to set the password after creating the user:

create user 'someone'@'localhost';
set password for 'someone'@'localhost' = password("foo");
select user,host,password,authentication_string,plugin from mysql.user where user = "someone";
-- +---------+-----------+----------+-------------------------------------------+-----------------------+
-- | user    | host      | password | authentication_string                     | plugin                |
-- +---------+-----------+----------+-------------------------------------------+-----------------------+
-- | someone | localhost |          | *F3A2A51A9B0F2BE2468926B4132313728C250DBF | mysql_native_password |
-- +---------+-----------+----------+-------------------------------------------+-----------------------+

What am I missing?

Best,
Philippe



 Comments   
Comment by Elena Stepanova [ 2018-07-10 ]

I think it's a documentation error (excessive generalization), I don't remember WITH and BY together ever work so far. Maybe it will work after MDEV-11340 is implemented.
serg, any comments? Do you want to extend the syntax or to fix the docs?

Comment by Sergei Golubchik [ 2018-07-10 ]

Yes, thanks. I've fixed the docs.

Generated at Thu Feb 08 08:31:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.