Answer the question
In order to leave comments, you need to log in
How to connect to MySQL database from local machine?
There is a server with phpMyAdmin at 185.65.137.xx/phpmyadmin/. I'm trying to connect to the server from the locale using a typical code:
public function __construct($hostname, $username, $password, $database, $port = '3306') {
$this->connection = new \mysqli($hostname, $username, $password, $database, $port);
// ...
$hostname
- this 'localhost'
. Answer the question
In order to leave comments, you need to log in
You specify a local address, but you need to specify a remote one.
In this case, the port must be open to the outside, MySQL must be configured for access from the outside.
it is not necessary to put the subd out on the Internet. this will not lead to good. it's much easier for you to set up an ssh tunnel - forward this one port from the server to your development machine. as a bonus, you don't have to edit the connection config. you will have the same localhost.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question