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 trialLeigh Maher
21,830 PointsCan't get mySQL Community server to work
I've tried downloading and installing mySQL Community server. I've tried it several times and tried different versions but nothing works for me.
Even the latest version of sqlWorkBench wouldn't open for me after I downloaded it. I had to go back to an older version just to get it to open.
I've given up on mySQL Community server and now I'm trying to find a way to use MAMP to get it working. I've tried everything that Andrew suggested in his post, but it just doesn't work for me and I keep getting this message when I set up a new server instance: Could not connect to MySQL server: Access denied for user 'root'@'localhost
I get the same thing when I try to set up a new connection. Also, every time it asks me to enter a password. What password are they looking for here. I don't remember creating a password at any stage.
Any help would be greatly appreciated.
Thanks.
5 Answers
Ryan Ruscett
23,309 PointsHey,
This has happened to me on windows. Sometimes, when you install mysql, depending on the package. The setup Phase does not prompt you to create a root user. It typically asks for a password, which should be the password to log in, but there is also checkbox that says allow remote connections. This should be checked. Now if the set up phase asks for a password only. You can install it and it takes a lot of extra steps to get it to work. When that happens to me, I just toss it and go back for another try. I installed 5.1 and 5.098 which seem to work well.
Should install, then when finished, there should be a configure button. Click configure. Then you pick detailed or basic, I choose detailed always. Then pick the type of server etc. Then there is a page that should say username, password and checkbox to allow remote connection. If this exists, you have a good version and it will work just fine. Just so as long as you enable remote connections.
Ryan Ruscett
23,309 PointsHola,
Yeah having multiple mysqls will do that to ya. localhost is the same thing as 127.0.0.1. See, a computer always checks it's host file before going out to the internet to resolve domain names to ip addresses. For example in windows there is windows/system32/drivers/etc/hosts. This hosts file has listing like this
localhost 127.0.0.1
Now when I type localhost into the browser. It looks there first. If it finds the domain name, it says ok i see it goes with this address. If not it goes out onto the old interwebs to some dns server to pair up a domain name ie (localhost) with an address ie(IP).
I have to ask, but is there an issue with connecting with the IP address? If not I wouldn't worry about it. If so then read on lol
When you connect to MAMP using 127.0.0.1 or localhost it should refer to the same place. Now, some instances of computers depending on if this is a work computer bought online or best buy. They will actually have a comment section at the localhost
localhost 127.0.0.1
If linux like ubuntu you can do
vi /etc/hosts
Check and see if it's commented out. Some applications if you install with ip address or localhost don't care if the localhost in the host file is commented out. Others do.
So I am just guessing, but if you go to your hosts file. I think you should see it commented out. If it is uncomment it and it should work. Another thing to make sure is they are not using the same port and that ports are available. You most likely arn't and the ports most likely are avail, just sayin. Sorry I am not to familiar with MAMP but I hope this helps.
Leigh Maher
21,830 PointsHi Ryan,
Thanks again for your comprehensive reply.
I had checked the hosts file before. I'm on a mac so it's located at /private/etc/hosts. There doesn't appear to be any issues with that file. It appear as: 127.0.0.1 localhost and it's not commented out.
In general I wouldn't have an issue having to use the ip address. It's just that I'm currently working on a Wordpress website and a lot of the paths to files have http://localhost at the start of them. I know I can change them with a plugin but for now it would just make things easier for me if I could access it via localhost.
How do I check they are not using the same ports?
Thanks.
Ryan Ruscett
23,309 PointsHey, I think you can do this.
lsof -n -i4TCP:$PORT | grep LISTEN
Found it on the internet. Not a big mac guy so I am not sure. This will tell you the ports and what is listening on them.
Yeah I am not sure what to do other than that. If it were a port conflict you would get it with IP address or hostname. So it's not likely and port conflicts would throw a different error of sorts.
Perhaps someone else on here has some ideas.
Leigh Maher
21,830 PointsHi Ryan,
Thanks a lot for the reply. I eventually got it installed using the same version you did. I've been banging my head against the wall since yesterday!
A few things I did while setting this up:
when I went to download an older version, it wouldn't allow me to install it. I got a message saying that there was a newer version already on my computer. Here's the solution I found for that: https://teamtreehouse.com/forum/erasing-mysql-from-mavericks-macos-and-reinstalling-errorfree-hopefully
another problem I was having, and I'm not sure if this was part of the solution for me, but it was something I did during this process. Basically, there was 2 versions of mysqld running at the same time. I think this is because I use MAMP too. So, I had to go into activity monitor and stop one instance from running. I got the solution here: http://eliteeternity.com/mysql-server-wont-start-mamp-red-light-mac/
Now, I'm left with one small problem: as I mentioned above I use MAMP. Since setting up mySQL Community Server, I've not been able to load my MAMP server at localhost. It will only show up at this ip address: 127.0.0.1
I've been searching online and it seems other people have this problem, too, but none of the solutions I've seen have worked for me. Do you by any chance use MAMP, and have you possibly come across this problem?
Thanks again.
Leigh Maher
21,830 PointsGreat. Thanks Ryan.
Leigh Maher
21,830 PointsHi Ryan,
I've just realized that I can't login to the backend of the local wordpress site that I'm working on. I'm able to load the login page by changing localhost to 127.0.0.1 but when I click on login, it brings me to the localhost version of the site, which obviously doesn't load for me now. Any ideas how to get around this?
Leigh Maher
21,830 PointsSorry Ryan, I just figured out how to change it to the ip address. Thanks for all your help. I really wish I could find a solution for the localhost issue, though. It's just niggling at me!
Leigh Maher
21,830 PointsI found out the reason why the localhost directory wasn't showing at localhost. In the etc/hosts file it had this extra line:
::1 localhost
I removed it and now it works at localhost. I've no idea what this line was doing, or how it got there. Any idea?
Thanks.