Cannot connect to database on a remote machine

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?

Welcome @tomtom555 Happy you are here

Use this tutorial Configure MySQL(MariaDB) for remote connections – Blog of Viov

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

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

Did you run this part?

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

Did you run

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

on your ssh terminal connected to the cyberpanel server

do i didnt beacuse i connect login mysql on ssh

The error is on cyberpanel server?

the error occur when i try to run this step

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?

Set a password for this user on mysql console

ALTER USER 'local4888’@‘localhost’IDENTIFIED BY 'littlewhale';

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

You need to add a new user with all privileges and use that user but you can alter that user with root privileges but first address the no password issue Cannot connect to database on a remote machine - #16 by josephgodwinke

You also go to https://SERVER_URL:8090/dataBases/listDBs and change the password for that user first then grant root privileges

I finally got it fix using this tutorial How to Allow Remote MySQL Connections

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

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.