"GRANT ALL PRIVILEGES" SQL is very convenient to create an user, but it cannot use on --skip-grant-tables environment through it is often used together.
Altenatively I can use INSERT INTO mysql.user syntax, but it is very complex.
How to repeat:
1) Launch mysqld with --skip-grant-tables.
2) Execute SQL like:
GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'password';
This causes error:
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
you have to run 'flush privileges' before grant will work when running with skip-grant-tables