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 trialiainfriend
4,439 PointsUser1 Access Denied
I am have problem trying to connect user1 to the database. It could up with error - "Error Code: 1044. Access denied for user ''@'localhost' to database 'treehouse_movie_db"
I am using MAMP and MYSQLWorkbench.
I have look on the forum and the web it mention something about socket.By running this command netstat -ln | grep mysqlin
terminal this the return message
Applications/MAMP/tmp/mysql/mysql.sock'
Does anyone how a solution to this error message?
Chad Burns
8,575 PointsSo, I was also unable to connect with user1 via localhost or its equivalent 127.0.0.1, and was able to fix the problem two different ways:
- Not changing Andrew's mysql statemant from the video at all, I was able to use my local IP address (ie 192.168.2.4) in Server Connection settings and use that to connect to the treehouse_moive_db.
To find you local IP address: On a Mac, go to System Preferences, click Network, and look for under "Ethernet" look for "IP Address" or under "Wi-Fi" and look for "Wi-Fi is connected to X and has the IP address of X.X.X.X". On a Windows PC, click the start button, click Run or click in the search box, type in cmd, hit Enter, type in "ipconfig", hit Enter, and look for IP Address or "IPv4 Address" for X.X.X.X (i.e. 10.1.42.2).
- Because I often change networks and my local IP address changes, I prefer this second way that lets you leave the IP address as 127.0.0.1 (which works even when I'm offline). To do this I follow the link that iainfriend mentioned: https://teamtreehouse.com/forum/cant-connect-user1-localhost-to-treehousemoviedb.
This has you modify Andrew's mysql statemant from the video changing user1@'%' to to user1@127.0.0.1. So, the whole mysql statemant looks like this:
GRANT SELECT ON treehouse_movie_db.* TO user1@127.0.0.1 IDENTIFIED BY 'password';
Even though I had already ran the GRANT SELECT statement, I ran the above statement again, and then ran the "FLUSH PRIVILEGES;" statement, and then I was able to connect using 127.0.0.1.
iainfriend
4,439 Pointsiainfriend
4,439 PointsI found the answer
https://teamtreehouse.com/forum/cant-connect-user1-localhost-to-treehousemoviedb
user1@'127.0.0.1'