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 Manipulating Schema with SQL Altering Tables

Sean Flanagan
Sean Flanagan
33,235 Points

Can't connect to MySQL server

Hi.

I can't link with the server. All the options like the one that executes MySQL commands are greyed out. I'd be most grateful for any help.

Sean

Are you using the Workbench and are you Windows or Mac?

Sean Flanagan
Sean Flanagan
33,235 Points

Hi Steve. Thanks for replying. Yes I'm using the Workbench. I'm using Windows 7.

OK - so are you at the home screen where a list of your connections in the main window and a load of shortcuts on the right? Do you have any created connections to localhost?

Sean Flanagan
Sean Flanagan
33,235 Points

In the bottom left corner it says there is no connection. On the left is the navigator menu and on the right is SQL Additions.

OK - so you are in the localhost? Is that what the tab right at the top says? There'll be a little house for home, then various tabs.

Down the left there should be a load of stuff - one of them is Startup/Shutdown - have you tried that?

Sean Flanagan
Sean Flanagan
33,235 Points

Hi Steve. I tried Startup/Shutdown but got a pop-up with the heading "Could not acquire management access for administration" and a paragraph saying "RuntimeError: Unable to execute command chcp. Please make sure that the C:\Windows\System32 directory is in your PATH environment variable." I clicked the Settings button then Test Connection but got another pop-up saying "Failed to connect."

Sorry for the delay - Googling!! I've only got this installed on the Mac which works in its own weird and wonderful way. Nothing like Windows, though. I'm downloading the workbench for Windows now but the broadband round here is awful so it'll take hours.

If you go to the Home icon, what do you have there?

6 Answers

Have a look at this to see if that assists...

Sean Flanagan
Sean Flanagan
33,235 Points

Sorry about the delay - my system crashed.

I'm not sure what the Home icon is, but I clicked the View menu and then Home. There's a grey box called Local instance MySQL 57 and it says "root" and "localhost3306". I've changed the Path to C:\Windows\System32 but it's made no difference. I don't know what to do now.

Did you try the advice in the link above? Repeated here. That's from someone having exactly the same problem as you have. I think you 've done that as you've changed your environment variable path to include System32; I hope you didn't change it just to that - it needs to be added to what's already there.

I've got MySQL on the Windows box now. I've got the same as you at Home; a grey box with "Local instance MySQL57", a user of root and a location of localhost:3306. If you hover over the top right of that box, the tear-down appears; click that once. What do you see?

One thing to try. Go to Run ... in the Windows start menu. type services.msc. Order that list alphabetically and scroll down to see if MySQL57 is running. If it isn't, right click it and change that. Then restart the workbench. Have you tried rebooting th machine after the workbench install?

Sean Flanagan
Sean Flanagan
33,235 Points

Hi Steve. Thanks for your help and apologies for the delay.

First, I did put System32 in the path but I didn't know it had to be added to what was already there; I deleted what was there. Due to the fact that this isn't something I do daily, my knowledge of this isn't as good as yours I'm afraid.

Second, on the teardown menu you mentioned, I saw:

Local management: Enabled
Config Path: C:\ProgramData\MySQL\MySQL Server 5.7\my.ini

Third, I've done everything you suggested starting with Run except reboot my computer, which I'm about to do right now. See you again in a bit! :-)

Hi Sean,

If you've changed the path like that you may notice some stuff doesn't work quite as expected. You'll know what to fix if that occurs!

In the teardown did you have a load of stuff about MySQL version, user account etc.?

Let's see what it looks like after a reboot; then we'll try creating a new connection. If all else fails, let's uninstall it and walk through the install together.

Steve.

Sean Flanagan
Sean Flanagan
33,235 Points

Hi Steve. Nice to hear from you again and thank you for your support. :-)

  1. So I have to go back to Environment Variables and add the configuration path onto what's already there do I?

  2. Yes I had info in the teardown like MySQL version, when I last connected, User Account, Password, Network Address, TCP/IP port, local management, config path, and two buttons at the bottom. On the left, Edit Connection. On the right, Connect.

  3. I've restarted my computer.

Ideally, the environment variable path shouldn't have stuff deleted from it. If you know what was there before, restore that and then add System32 directory. TBH I'd be surprised if that folder wasn't already in the path.

Following the reboot, open up the workbench and try the connection again... same error? Is the service running in services.msc?

Sean Flanagan
Sean Flanagan
33,235 Points

I've started the service running in services.msc.

Cool - try the sql connection ... same error?

Sean Flanagan
Sean Flanagan
33,235 Points

I went to the Database menu and clicked Connect to Database and when the Query 1 tab opened, some of the options that were greyed out before, including the Execute command, are now available.

That sounds like you're good to go, then! Click 'Server Status' on the left column and check you're green.

Sean Flanagan
Sean Flanagan
33,235 Points

I just typed in

USE movie_db_1; and a tick appeared in the Output box underneath. I clicked on the Schemas tab in the Navigator sidebar on the left and movie_db_1 et all are still there, thank God! I've bookmarked both this thread and the other one that you showed me in case this problem arises again.

You've been a terrific help Steve. Thank you for all you've done! I've given you the Best Answer. <handshake> :-)

No problem - glad to get it up and running!