Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Database Foundations Securing and Maintaining a MySQL Database Setting up Multiple Users

Can we log in as multiple users on localhost (just to try all of this out?)?

This video has Andrew creating a bunch of users with a remote database. Can we do this on our localhost as well?

I don't mind just watching along for most of it, but I'd much rather be able to try it out!

Thanks!

3 Answers

Yes, you can. Users are essentially just data records/rows in a database with login and permissions info.

Thanks! How would I go about doing this with MySQL Workbench (as shown in the video)?

Conrad Spotts
Conrad Spotts
11,768 Points

I'm following along with this course using SQL Workbench 5.6 so the interface is a little different, but the info to be entered is the same.

In order to follow along and not hit errors while running local host, use '127.0.0.1' instead of '%' when setting up the user in your SQL statement.

for instance: GRANT SELECT ON treehouse_movie_db.* TO user1@127.0.0.1 IDENTIFIED BY 'password';

Then, when creating a new connection, the credentials should be accepted. I was hitting problems following along on this myself when I tried using user1@'%' in my SQL statement.

So far all the other commands seem to work. I know this is a late answer (2 months after the fact), but hopefully it'll help someone else!

I haven't really used Workbench, but from what I can see from a quick search, you would set up a new 'Connection', with the new user name and password (and the rest of the details matching your local database/host).

Here's one article I found, though it's focused on connecting to a remote database, not a local one: Connecting to a database with MySQL Workbench 5.2