How to implement mysql? on linode

here"s the thing.
I have XAMPP, installed on local localhost, he installs mysql and phpmyadmin
I have manual installation of mysql in linode
this person has a different number of databases
, but I all connect in the same way

.
$servername = "localhost";
  $username = "root";
  $password = "xxx";
  $mysqldb = "xxx_db";

so when I check the web on linode, he will receive his own mysql
, but when I am on localhost, he will receive xampp"s mysql
what I want to do now is:

I want localhost to connect to mysql when it connects to linode"s mysql instead of xampp"s
so what configuration should I make on linode and localhost to implement?

I added a user ID to linode"s mysql.
the hostname is IP
, but I still can"t.

mysqli::__construct(): (HY000/2002): Operation timed out in /xxx/xxx/xxx.php on line 17
Error: Operation timed out

charge

clipboard.png

but it still doesn"t work.


  1. $servername is changed to the ip address of linode
  2. root user of mysql on linode, allowing remote access
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456'
  1. check the my.cnf file on linode. The binding address cannot be 127.0.0.1

is not very clear about linode, but the general virtual space does not allow you to access the database remotely, so it gives you a way to access phpmyadmin.
but his phpmyadmin is installed on the server, so its localhost is the server.
generally, it doesn't allow you to access remotely, and you can't have root permission, so you shouldn't be able to access the database remotely.

if you have root permission, please search "mysql remote access" to find the settings you want.


I haven't used linode,. Personally, if the configuration and mysql user settings are all right, it may be because the platform restricts the port (similar to Aliyun's security group)

Menu