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?
Related
Got a new laptop [Windows 11] and for the first time I am facing issues with MySQL server. It installs alright but fails at the step "Starting server".
When I check the logs on the next tab I get the error message:
Attempting to connect to Mysql#localhost:3306 with user root with no password... MySQL error 1042: Unable to connect to any of the specified MySQL hosts.
I have tried other versions, tried to start server from services, changed to Local System Account under service properties, but still the server just wont start.
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.
I am aware that this question has been asked many times before, but all solutions I tried out did not work for me.
So, I installed MySQL Workbench and server. I log into Workbench as root. In the toolbar I click on Server then Startup/Shutdown and there I click on the button Start Server. But whenever I do this, I get following log:
018-05-14 21:09:59 - Starting server...
2018-05-14 21:10:07 - Server start done.
2018-05-14 21:10:09 - Checking server status...
2018-05-14 21:10:09 - Trying to connect to MySQL...
2018-05-14 21:10:09 - Can't connect to MySQL server on 'localhost' (10061) (2003)
2018-05-14 21:10:09 - Assuming server is not running
Addiotionally a popup appears which says:
Connect Error
Could not connect to MySQL: Can't connect to MySQL server on 'localhost' (10061)(code 2003)
One solution I found suggested installing the server manually. So I went into cmd as admin and typed:
C:\> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld" --install
It gave following output:
Service successfully installed.
But in Workbench the Server is still stopped and when trying to start it like mentioned above the same logs with the same popup and error appears.
Another solution I found suggested installing MySQL Notifier and using it to start and stop the server and use it to manage monitored items. But quite frankly, once I restart workbench and try to log in as root, it wont even log in but give following pop up error:
Cannot Connect to Database Server
Your conection attempt failed for user 'root' from your host to server at localhost:3306:
Authentication plugin 'catching sha2 password' cannot be loaded: Das angegebene Modul wurde nicht gefunden.
Please:
1 Check that mysql is running on server localhost
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the root has rights to connect to localhost from your adress (mysql rights define what clients can connect to the server from which machines)
4 Make sure you are both providing a password if needed and using the correct password for localhost connecting from the host adress you're connecting from
So now this "Authentication plugin 'catching sha2 password' cannot be loaded:" looks suspicious and I tried looking that up. I found this solution, which requires me to log into MySQL from cmd, but when I type C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p and execute it, it asks for the password which I provide, but then it answers with
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
Now I hit a wall and I don't know how to continue. The MySQL server still doesn't work and I am desperate.
Do you have SQL Server (MSSQL) instance installed on your machine? If so, this may cause an issue. MSSQL may "capture" port 3306. Try to stop MSSQL service and test MySQL.
The easiest way to resolve the error where the service does not start is by going into the registry as Administrator.
Navigate to HKLM\System\ControlSet001\Services\MySQL
Change image path to "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe" --defaults-file=C:\Program Files\MyNewSQL\bin\MyNewSQL.ini MyNewSQL
My problem (same as yours):
Current Registry Setting:
C:\MySQLs\MySQLDev\bin\mysqld --defaults-file=C:/MySQLs/MySQLDev/MySQLDev.ini MySQLDev
Change Registry Setting to:
C:\MySQLs\MySQLDev\bin\mysqld.exe --defaults-file=C:/MySQLs/MySQLDev/MySQLDev.ini MySQLDev
Rerun "net start MySQLDev"
The MySQLDev service is starting.
The MySQLDev service was started successfully.
On Windows 10 and previous versions, you MUST give the User assigned to the MySQL service full permission of the MySQL folders.
I believe the newest version uses, User NETWORK SERVICES, therefore use File Explorer, right click on all of the MySQL folders, click on Properties, Security, Edit and give User NETWORK SERVICES full access of those folders.
Failure to do this will result in the Service starting and stopping due to errors which are visible if you use Command Line.
openshift scaled app with port forward - Unable to access mysql on localhost.
I have a simple php scaled app, I was able to setup the port forwarding for myapp. I can see that the 127.0.0.1:37731 is pointing to the openshift mysql gear.
But when I try to access mysql on command line or using mysql workbench, I am getting a
"Connected to MySQL at 127.0.0.1:37731 with user adminXXXXX", connection parameters are incorrect error.
I am ubuntu. "adminXXXXX:#127.0.0.1:37731:" is the connection string when I copy it from the workbench.
Try specifying the host separately.
E.g. after port forwarding, I entered
mysql --host=127.0.0.1:40793
and got
ERROR 2005 (HY000): Unknown MySQL server host '127.0.0.1:40793'
but this worked:
mysql --host=127.0.0.1 --port=40793
I have setup a simple web service, when using just the python3 manage.py runserver it works fine, but when I deploy the application to Apache by using mod_wsgi it give the following error:
(2003, "Can't connect to MySQL server on 'localhost' ([Errno 13] Permission denied)")
I have also tried using the server's name and then the server's ip and it just replaces localhost in the error message.
Here is a copy of the XML when navigating to the page: http://pastebin.com/QtRzi0X6
Edit:
Also I would like to add that I am running on Fedora 20, Python3, Django 1.6, and MariaDB, Also I am use PyMySQL for django and python 3 so it can connect to MySQL
As it turns out (After hours of searching and testing), this is actually a apache/mod_wsgi problem, just type the following command to allow apache to make database connections:
setsebool -P httpd_can_network_connect_db 1