Save 36% for Black Friday! Learn more

All threads / Grant all privileges problem

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

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

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

Join the discussion

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

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

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

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.