Community

Closed Cannot connect to database on a remote machine

ET
Emmanuel Tom #1

I just installed cyber panel on my server runing ubuntu 20 and i created a datebase using the create datebase of the cyberpanel, but when i try to connect to the mysql datebase on my local computer i get the error :

mysql.connector.errors.DatabaseError: 2003 (HY000): Can’t connect to MySQL server on ‘IP Address’ (10060)

If I connect on localhost it works fine but if I want to connect to the database remotely the error pops up

during installation i saw :
Remote MySQL (default N):

  • Allow for your Database to be installed on a remote server*

i left everything to the default which is No, does this mean i cannot connect to mysql remotely?

ET
Emmanuel Tom #5

Okay thank you so much @josephgodwinke, I’m checking now, i will let you know if it works

ET
Emmanuel Tom #7

according to the toturial:
I have added the port 3306 with the ability to allow any connection from any IP by seting the IP Address to 0.0.0.0/0

but i keep getting
Access denied for user ‘local4888’@‘localhost’ (using password: NO)
when i want to connect mysql on my local host

so ignore creating a new user from CLI and i created in phpmyadmin but i still cannot connect to mysql remotely.

Is it compulsory to create mysql user in CLI before i can connect to the database remotely

ET
Emmanuel Tom #9

no i run the Local environment section.
what they they refer to as local and production environment?

jo
josephgodwinke #10

Did you run

GRANT ALL PRIVILEGES ON *.* to 'yourdbusernamehere'@'youripv4publicaddressforCyberPanelserver' IDENTIFIED BY 'yourdbpasswordhere';

on your ssh terminal connected to the cyberpanel server

jo
josephgodwinke #13

The error is on cyberpanel server?

ET
Emmanuel Tom #15

i log in ssh as a root user and it works

But i still connect connect to msql remotely. do i have to restart my server?

jo
josephgodwinke #16

Set a password for this user on mysql console

ALTER USER 'local4888’@‘localhost’IDENTIFIED BY 'littlewhale';
ET
Emmanuel Tom #17

this user is was not even amount my DB users, it is cypanel user created automatically on website creation

jo
josephgodwinke #21

So the iptables part helped you on top of firewalld part or you did not touch the firewalld?

This topic is closed to new replies.