Home  >  Article  >  Backend Development  >  When using mysqli to connect to the database, an error is reported, but the connection can be made by replacing it with mysql_connect.

When using mysqli to connect to the database, an error is reported, but the connection can be made by replacing it with mysql_connect.

WBOY
WBOYOriginal
2016-10-10 11:55:581092browse

There is a virtual host on Alibaba. I wrote a small program and wanted to run it on it. The code uses mysqli to connect to the database and reports an error, but it can be connected by using mysql_connect.
Mysqli connection error message:
Warning: mysqli::mysqli(): (HY000/1044): Access denied for user 'qdm177116231'@'%' to database 'data' in D:Xampphtdocstest.php on line 475

Reply content:

There is a virtual host on Alibaba. I wrote a small program and wanted to run it on it. The code uses mysqli to connect to the database and reports an error, but it can be connected by using mysql_connect.
Mysqli connection error message:
Warning: mysqli::mysqli(): (HY000/1044): Access denied for user 'qdm177116231'@'%' to database 'data' in D:Xampphtdocstest.php on line 475

At least post the code. It may be that you filled it in wrong or you don’t have enough permissions

qdm177116231'@'%
Check the user table to see if the user has permission to access the host~~~

The database user qdm177116231 has insufficient permissions. You can use navicat to update the user and it should be fine

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn