Home > Article > Backend Development > Alibaba Cloud virtual host database connection error
$mysqli = new mysqli('qdm177116231.my3w.com', 'qdm177116231', "**", "data");
Error:
mysqli::mysqli(): (HY000/1044): Access denied for user 'qdm177116231'@'%' to database 'data'
Permissions cannot be set, and remote login is not possible, but the database can be operated in the tp framework
$mysqli = new mysqli('qdm177116231.my3w.com', 'qdm177116231', "**", "data");
Error:
mysqli::mysqli(): (HY000/1044): Access denied for user 'qdm177116231'@'%' to database 'data'
Permissions cannot be set, and remote login is not possible, but the database can be operated in the tp framework
From your error report, it seems that the user is allowed remote access, but what about your database itself? Is remote access enabled? Also, if the information you filled in is incorrect, it is recommended that you submit a work order to consult with Alibaba technical personnel.
My database connection error sometimes happens, but it works again after restarting
If you cannot log in to RDS remotely, it means that RDS has set up a whitelist and only allows ECS intranet IP connections.
You can go to the Alibaba Cloud platform to add your IP to the whitelist.