By Default MySQL only accept local connection to enable MySQL access from remote computer we need to make some changes. Edit /etc/mysql/my.cnf file and search for bind-address line and comment it out and save it.

User Permission

Login to MySQL by issuing following command, you will be prompted for my your MySQL root password.

Enter MySQL root password that we set when you installed MySQL server on rpi, after successful login issue following command to give access to SQL server from remote IP address. (change IP address of your required one and password that you want to use).

Firewall Settings

Raspberry pi OS comes with built-in firewall and it blocks all incoming connections. Now configure iptables so it accept remote connection for MySQL traffic from our remote computer, run following commands and make sure you don’t get any errors.

To test the connection remotely try to connect your MySQL server from remote computer with credentials you added.