简体   繁体   中英

Can't connect to MySQL server from localhost but MySQL service is running

No matter what I try i keep getting this error:

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061).

This goes for: 1) >mysql 2) >mysql -u root 3) >mysql -u root -p 4) >mysqlshow etc....

Mysql version: 8.0.12.0
OS: Windows 10

So the suggested solution I keep encountering is to enable the mysql service manually, but the mysql80 service is running no problem and the port 3307 (i tried both the default 3306 and 3307 ) show up in netstat as:

TCP    0.0.0.0:3307           0.0.0.0:0              LISTENING

I don't see anything wrong in my my.ini file either (skip-=networking= is commented out and there is no bind-address line), but just in case here is a link: https://drive.google.com/file/d/1udfXwvl-W7UI3pCissTTBYD0wNnDTBiT/view?usp=sharing .

mysqld -u root --skip-grant-tables Doesn't do anything at all, no error messages either.

I disabled firewall as well but still no luck.

I've been looking for a solution for days on end now so any help is much appreciated.

EDIT: to clarify I cannot access the sql shell via the command line, because this also gives me ERROR 2003

Okay so i finally got it to work, I don't know where the issue was but this is what I did:

1) stop the mysql80 service and delete it with Sc delete MySQ in the cmd

2) Go to Add or remove programs and uninstall anything mysql related

3) remove the mysql folders in Program files, programData and C:\\Users\\username\\AppData\\Roaming

4) download sql community installer and when asked if you want to download the latest installer DON'T download it, just use the current one. Previous clean re-installs didn't work until I stopped using this newer installer version.

5) Reinstall everything as before

6) SUCCES!

After stopping firewall restart system and check. Run the cmd as Administrator and check. Please paste the error log for more clarity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM