use PDO
and $con = new \PDO('mysql:dbname=l2jdb;host=localhost:3306', 'username', 'password');
you can change port with this addition btw for a +1 security reason
but the question was how to access
open the port 3306
pass it from firewall
create a user in navicat that will access the database from outside
make hes ip wildcard %
if your ip is changing after a router restart install a no-ip
and use in your site your ip or no-ip to connect your sql codes