Ask A Question

Notifications

You’re not receiving notifications from this thread.

Grant all privileges problem

Jørund Jenssen Berg asked in General

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 =)

Reply

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

Reply

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

Reply

It worked - thanks again!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,168+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.