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 Installing MySQL Server and MySQL Workbench Installing MySQL Server and Workbench on OS X

Yuichi Narisawa
Yuichi Narisawa
19,548 Points

I cannot connect to the server. Please help!

I've just followed the tutorial and installed the MySQL and workbench. However, I've got "Failed to Connect to MySQL at localhost: 3306 with user root Access denied for user 'root'@'localhost'(using password:YES)" How can I run this server?

1 Answer

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Which OS do you have ?

The problem is when you install MySQL server temporary password is generated for root user

I advice you install 5.7 version, because upon installation it prints root password

http://dev.mysql.com/doc/refman/5.7/en/osx-installation-pkg.html

If you have installed 5.6 password, and don't know how to reset. Try my guide here

https://teamtreehouse.com/community/error-connecting-to-database-server-access-denied-for-user-root-localhost-how-do-i-reset-the-password

It may help, may not, but you can take a look how to reset root password.

The same thing on Windows

http://dev.mysql.com/doc/refman/5.7/en/mysql-installer-gui.html

So I strongly recommend to remove old version , if it was < 5.6 and install new 5.7

Yuichi Narisawa
Yuichi Narisawa
19,548 Points

Hi Alex! Thank you for the info! I didn't pay attention for the password during the installation. I use Mac OSX, and I re-installed it as your suggestion. This time, I took a picture of the password, and carefully typed in... I'm not sure the process I did was right, but somehow I could connect to the server! Thank you so much!

Oh, BTW, Is there any place to store the password which is generated by the program?

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Oh, BTW, Is there any place to store the password which is generated by the program?

What do you mean where to store it ?

Write it down somewhere safe. There is a way to change it to the one you can remember but it is much harder.

Since you are using your database for non-commercial purposes, you can write it down in some file on computer, not that is so dangerous for someone to see this password.

And it also should give you an option to remember password ...

I use Linux, so I cannot play around and say more unfortunately ...

Yuichi Narisawa
Yuichi Narisawa
19,548 Points

I mean, if the installer generated some log file of the password in a system, I could find it without re-install. Never mind, I understand the concept and it works!

Again, Thank you so much!

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Now I see what you mean.

You are right upon installation, there should be so-called mysqld.log file, in which this temporary password should be printed

The pathway depends on your OS

According to this post:

http://stackoverflow.com/questions/33326065/unable-to-access-mysql-after-it-automatically-generated-a-temporary-password

It should be in

/var/log/mysqld.log

But that probably for Linux.

For Mac such file should be somewhere in

/usr/local/mysql/data/mysqld.log

According to post here

http://serverfault.com/questions/42531/where-is-my-mysql-log-on-os-x

Like I said, I don't have Mac around, so I can't say more, but if you want to dig into it, you can try from those locations

Yuichi Narisawa
Yuichi Narisawa
19,548 Points

Thank you for the detailed info! I've never dealt with this kind of stuff, so almost everything is new to me. Sometimes they're really intimidating and overwhelming, but I can keep going because of you guys give me a great advice whenever I stack. I really appreciate it!