I\'m trying to automate MySQL user creation procedure. I thought of creating a temp file that would contain mysql user creation statements, then I would have call it like this :
If you do not want to store password in clear text, then save it in hashed format -
GRANT ALL PRIVILEGES ON mytestdatabase.* TO 'mytestdatabase'@'localhost'
IDENTIFIED BY PASSWORD '*7560636C2922C05954FE6A2446AA00C84708B57B';
Where hashed password is a result of this query -
SELECT PASSWORD('my password');
I have also got same problem, it is resolved just by setting the password by mentioned query below.
SET PASSWORD FOR 'user'@'localhost' = PASSWORD('MyNewPass');
Well hat is error bcoz you have wrote the wrong way just you have wrote,
GRANT ALL PRIVILEGES ON *.* TO 'USER'@'localhost' IDENTIFIED BY PASSWORD '@password';
and the true syntax is follows. look here.
GRANT ALL PRIVILEGES ON *.* TO 'USER'@'localhost' IDENTIFIED BY '@password';
because your password is causing that error. it must be in as shown.
Take a look at the following url and this will help you to fix the issue:
http://linuxadministrator.pro/blog/?p=147
mysql> select password('12345');
+-------------------------+
| password('123456') |
+-------------------------+
| 2ff898e158cd0311 |
+-------------------------+
1 row in set (0.00 sec)
mysql> create user test identified by password '2ff898e158cd0311';
Query OK, 0 rows affected (0.00 sec)
try:
GRANT ALL PRIVILEGES ON mytestdatabase.*
TO mytestdatabase@localhost IDENTIFIED BY 'PASSWORD';
where PASSWORD is your password (in quotes).
I opened phpMYAdmin and went to the the users tab, found the user i was trying to connect with clicked Edit Privileges, scrolled down to the Change Login Information / Copy User section and choose Any host for the Host option, it was set to local. When I clicked the Go button, it generated a script similar to the ones listed here.
GRANT ALL PRIVILEGES ON * . * TO 'james'@'%' IDENTIFIED BY PASSWORD '*780E1D13F1C7713F341A117499C6D8644464C4CF' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;