Can't connect to mysql server on windows 10 - mysql

I am trying to connect the MySQL server (mysql-5.7.23) from command prompt using the command mysql -u root it throws an error ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061).
I am using Windows 10.
I have followed following steps :
Unzip the mysql-5.7.23 file and put on C drive.
Add the data folder in the installation directory and also add the my.ini
Went to the bin folder in command prompt and executed mysqld --initialize-insecure, it generated some file in the data folder.
Then I added the mysql path environment variable.
After that I started MySQL service. It is running properly.
Again in the command prompt, I have executedmysqld --install, it shows service already exists.
But when I tried to connect to the server, it throws an error, ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
I have tried all solutions from ERROR 2003 (HY000): Can't connect to MySQL server on localhost (10061)
, but still it is not working.
Am I missing something?
Edit : One more observation, when I execute mysqld, the cursor in the command prompt return to again current directory, which I think is not expected behavior.

Related

Error when using the command line terminal to connect to the Azure MySQL server

I'm using the command line prompt on my Windows computer to connect to my Azure MySQL server.
hostname=flashguard.mysql.database.azure.com
username=damiboyflashguard123
port=3306
I entered following on my cmd
mysql -h flashguard.mysql.database.azure.com -P 3306 -u damiboyflashguard123 -p
and entered the password. Then I'm getting following error,
ERROR 2003 (HY000): Can't connect to MySQL server on
'flashguard.mysql.database.azure.com:3306' (10060)
By the way I checked my firewall settings, and it shows firewall is approving on 3306 port requests as follows.
I installed MySQL client in my local machine and tried connecting to Azure mySQL client via command line terminal and was connected successfully:-
ERROR 2003 (HY000): Can’t connect to MySQL server on
‘flashguard.mysql.database.azure.com:3306’ (10060)
Make sure your MySQL server name with username and password does not have any syntax missing or spelling errors. Add your local machine’s IP to the allowed list of Azure MySQL servers like below:-
Make sure your MySQL server is in a ready state and also try to connect to your MySQL server from your Azure Portal to check the connectivity.
Verify your connecting string from Azure Portal like below:-
I ran the above command in my local machine’s command line terminal and I got connected to the azure MySQL server successfully like below:-
mysql -h server-name.mysql.database.azure.com -u xxxxconuser -p xxxxxxxxxn#123
Output:-
When I removed the Client IP from the azure MySQL Networking tab, I got the same error code as yours, refer below:-
Error:-
Verify if you’re connected to any VPN that is restricting you from connecting to the MySQL server on Azure.

MySQL connection error after docker removed

Error Message is:
Warning: mysqli::__construct(): (HY000/1130): Host 'host.docker.internal' is not allowed to connect to this MySQL server in E:\wamp64\www\FISH\test13\records.php on line 61
Error failed to connect to MySQL: Host 'host.docker.internal' is not allowed to connect to this MySQL server
On Windows 10, using VSCode, wamp, localhost, mysql
Was working fine, then I installed Docker Desktop on Windows
Was having trouble understanding Docker, so I uninstalled it from Control Panel ->Programs and Features.
Now when I return to localhost website, I get the error message (as above).
I have additionally removed any reference to 'docker' using regedit.
I removed all files 'docker' from file system.
Rebooted.
root user has full access to database as confirmed in:
Server: MySQL:3306 »Database: mysql »Table: user“Users and global privileges”
Any ideas how to remove error message and get system working again? Or do something to just move on from this error?

Cannot connect to MySQL server via command line while Workbench can work

I have a MySQL server running on Windows 7 (technically on a virtual machine but I don't think that matters). I have configured everything and it seemed fine at first. I tried to connect to the server via command line and it worked. Then I tried to connect to it via Workbench and succeeded again. However, I can no longer connect to the server with command prompt ever since that. The client machine is in a different sub-network.
My command is like:
mysql -host HOST_IP -P PORT -uUSER -pPASSWORD
And it returns:
ERROR 2005 (HY000): Unknown MySQL server host 'ost' (0)
The problem is that while I can connect to the server via Workbench, the command line just won't work. It all happens after I connected with Workbench. Does it has anything to do with Workbench? Or is caused by other issues?

MAMP on Windows - ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061) when trying to log-in into MySQL via command line

I am reading the book 'PHP and MySQL Web Development(Developer's Library)' Fourth Edition by Luke Welling and Laura Thomson and i'm in the part where i need to log in and create a database via the command line(cmd) of Windows but when i am trying to log in, i am getting the following error:
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
I am using MAMP on Windows 10. What i've done in so far is i ran the MAMP server(MySQL Server is shaded green: turned on) and change the directory on the command line where the MySQL is located. Is there a detail that i forgot to do?
See this link: https://stackoverflow.com/a/23532364/7618391
For me, I was using a port different than the standard MySQL port. Once I changed the MySQL port in MAMP to 3306, it worked fine.
Good luck.

Access denied when trying to access http://localhost/phpmyadmin. Receiving the error: mysqli_real_connect(): (HY000/2002): No such file or directory [duplicate]

This question already has answers here:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
(88 answers)
Closed 5 years ago.
I am unable to access phpmyadmin on the localhost. On the phpmyadmin page it says "MySQL said: 2002 - No such file or directory — The server is not responding (or the local server's socket is not correctly configured)."
I am also unable to login to my mysql as well since I am unable to find the password to login. When I enter -u root -pinto the terminal I am prompted to enter a password and after I hit enter I receive the error message ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2). I already have XAMPP installed and I also made sure the mysql was installed locally by entering sudo apt-get install mysql-server. I am at lost as to why I am having this issue and how to solve it.
I was able to solve this issue. It turns out I already had MAMP installed (in addition to XAMPP) and it was already running MySQL on the localhost, but not the Apache server. I simply stopped all servers on XAMPP and was able to start Apache and MySQL on MAMP and then was able to access phpmyadmin on the localhost.