Skip to main content

Grant all privileges problem

General • Asked by Jørund Jenssen Berg

Fallback

Hi,

I´m a total newbie and in the process of learning Ruby on Rails. So far I´ve installed Ruby (version 2.5.1) on my Mac and created a database. Now I want to create a new user to a demo project I´ve created, and grant the new user all privileges. When I entered the following code in Terminal...

mysql> GRANT ALL PRIVILEGES ON demo_project_development.* TO 'rails_user'@'localhost' IDENTIFIED BY 'secretpassword';

...I got the following error message:

ERROR 1064 (42000): 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 'IDENTIFIED BY 'secretpassword'' at line 1

I´ve tried looking for the manual, but I´m not quite sure what I´m looking for! So any help would be appreciated. Either by telling me how my code is not appropriate for this version, or where I can find this manual.

Thanks =)


Fallback

I think maybe you're mixing commands. When you create user, you specify the password. When you grant privileges, I don't think you want the "IDENTIFIED BY PASSWORD" part.

Here's a good little blog post that explains more about it. https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql


Fallback

Thanks a lot Chris! I´ll try it out =)


Fallback

It worked - thanks again!


Login or create an account to join the conversation.