How To Allow Remote Access to MySQL

:warning: IMPORTANT, please fill the questions

We assume you are using Bitnami to deploy your application.

  • Which version of the application are you using?: * Bitnami LAMP 7.4.10-0

  • Please choose how you got the application: Installer (Windows, Linux, macOS), cloud image (AWS, GCE, Azure, …) or VM (VMDK, VBOX): AWS

  • Have you installed any plugin or modified any configuration file?: No

  • Describe here your question/suggestion/issue (expected and actual results): How To Allow Remote Access to MySQL.
    In my codeigniter app there is in issue. To solve the issue i need to allow remote access to my sql .Please help me to Allow this access.

my sql details

Database server
Server: Localhost via UNIX socket
Server type: MySQL
Server connection: SSL is not being used Documentation
Server version: 5.7.26 - MySQL Community Server (GPL)
Protocol version: 10
User: root@localhost
Server charset: UTF-8 Unicode (utf8)
Web server
Apache
Database client version: libmysql - mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $
PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation
PHP version: 7.1.30

  • Steps to reproduce the issue (if relevant):

  • Copy the apache log (if relevant):

PASTE HERE

Hi @bellfruittechnologie

Thanks for using Bitnami LAMP!

We have a guide that covers how to access MySQL remotely, and even how to connect to MySQL Workbench. Could you please check them out?

https://docs.bitnami.com/aws/infrastructure/mysql/administration/connect-remotely/
https://docs.bitnami.com/aws/infrastructure/mysql/configuration/configure-workbench/

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart:

My problem is i have an issue while connecting from mobile using api. But when connecting from web is working fine. I am googled and find “Allow remote access to mysql” will solve the issue.

https://www.google.com/amp/s/www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql.amp

What about this process???

Hi @bellfruittechnologie

As stated by the aforementioned guide:

IMPORTANT: By default, the database port for the nodes in this solution cannot be accessed over a public IP address. As a result, you will only be able to connect to your database nodes from machines that are running in the same network. For security reasons, we do not recommend making the database port accessible over a public IP address. If you must make it accessible over a public IP address, we recommend restricting access to a trusted list of source IP addresses using firewall rules. For development purposes, you can also use a VPN or SSH tunnel. Refer to the FAQ for information on accessing restricted ports using an SSH tunnel or opening ports in the server firewall.

If you still want to access using the public IP address, you may follow the guide on how to add firewall rules that allow traffic to port 3306 (MySQL):
https://docs.bitnami.com/aws/faq/administration/use-firewall/

My recommendation is to restrict that flow only to a certain IP, to prevent outsiders to connect to your instance.

Additionally, you may change the /opt/bitnami/mysql/conf/my.cnf file to intruct MySQL (version 8) not to limit to local connections:

...
[mysqld]
skip_name_resolve
explicit_defaults_for_timestamp
basedir=/opt/bitnami/mysql
port=3306
tmpdir=/opt/bitnami/mysql/tmp
socket=/opt/bitnami/mysql/tmp/mysql.sock
pid_file=/opt/bitnami/mysql/tmp/mysqld.pid
max_allowed_packet=16M
- bind_address=127.0.0.1
+ #bind_address=127.0.0.1
...

You may now restart the MySQL service and you will be able to connect from the outside:

$ sudo /opt/bitnami/ctlscript.sh restart mysql

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart: