Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am unable to connect my sql it is showing this error

\connect root@localhost;
Creating a session to 'root@localhost;'
Please provide the password for 'root@localhost;': **********
MySQL Error 2005: No such host is known 'localhost;'



the password is correct

What I have tried:

dont know what to do as i am a beginner i am struct with this unable to found the solution
Posted
Updated 5-Feb-22 22:38pm

Start by checking that MySql is installed on your local machine. If it isn't, then you can't connect to it.

If it is, then use MySQL workbench (google will find it for you if you don't have it installed) to check the configuration of MySql on your system.

Sorry to sound vague, but we have no access to your machine, and thus can't do anything specific to help you from here!
 
Share this answer
 
The problem could be due to different IP address in your hosts file.
Go to the following path (C:\Windows\System32\drivers\etc)and check IP address of localhost in the hosts file. Use root@127.0.0.1 (assuming 127.0.0.1 is the IP in your hosts file) instead of root@localhost for connectivity.
 
Share this answer
 
Remove the semicolon at the end. MySQL Shell commands don't use a terminating semicolon and it tries to find server called localhost; instead of localhost
MySQL :: MySQL Shell 8.0 :: 3.1 MySQL Shell Commands[^]
 
Share this answer
 
Comments
VINEET MENDON 7-Feb-22 8:40am    
thank you soo much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900