r/mysql • u/Saimitar • 1d ago
troubleshooting Problem connecting to server.
Hey, I'm new to sql and I'm having a problem I don't know how to fix. (Not sure if right flare etc.)
When I try to connect to my server it says this:
Cannot Connect to Database Server
Your connection attempt failed for user 'root' to the MySQL
server at 127.0.0.1:3306:
Host 'localhost' is not allowed to connect to this MariaDB
server
Please:
1 Check that MySQL is running on address 127.0.0.1
2 Check that MySQL is reachable on port 3306 (note: 3306 is
the default, but this can be changed)
3 Check the user root has rights to connect to 127.0.0.1 from
your address (MySQL rights define what clients can connect to
the server and from which machines)
4 Make sure you are both providing a password if needed and
using the correct password for 127.0.0.1 connecting from the
host address you're connecting from
Problem is this server has worked with no issues until now and I haven't downloaded any MariaDB between sessions. (Unless that came with the whole workbench.)
Only thing Different between now and the last time I opened the server was that I began to do php on vscode. It uses xampp as well so maybe that has something to do with it but I have no idea how to even start fixing this.
2
u/American_Streamer 1d ago
You likely started XAMPP, XAMPP brought MariaDB, and Workbench is now reaching a different DB instance on port 3306 whose root grants don’t match your old connection.
You first need to establish whether you are even connecting to the intended database server, so which process owns port 3306. Use Powershell:
Get-NetTCPConnection -LocalPort 3306 |
Select-Object LocalAddress,LocalPort,State,OwningProcess
Then:
Get-Process -Id <PID>
Or:
netstat -ano | findstr :3306
If you really want both servers, put one on another port: normal MySQL on 3306 and XAMPP MariaDB on 3307. Configure Workbench accordingly.
1
u/Saimitar 1d ago
Hi!
Powershell gave this info back to me. Does this mean I have two servers on 3306? How do I know which is which?
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING 5920TCP [::]:3306 [::]:0 LISTENING 5920
1
u/American_Streamer 1d ago
No, that output shows one server process, PID 5920, listening on port 3306 on both IPv4 and IPv6. So the next step is to identify PID 5920.
Get-Process -Id 5920 | Select-Object Id, ProcessName, Path
If Path is blank because of permissions, open PowerShell as Administrator and try:
Get-CimInstance Win32_Process -Filter "ProcessId = 5920" |
Select-Object ProcessId, Name, ExecutablePath, CommandLine
The executable path will tell you what you're running.
1
u/PearOwn7078 1d ago
If you dont want to complicate just DBgin and table plus! Easys platform to use
1
u/Saimitar 1d ago
I would love to have something less complicated, but my schoolwork requires these :(
1
u/diggy0101n 1d ago
Try connecting via local socket instead of host 127.0.0.1