1
I’m making an unusual mistake for myself. Next: when I try to connect via mysqli I get error return on authentication ( access denied ), and the parameters are all correct! To confirm this access normally through SSH console with the same parameters and succeed, but mysqli does not work! What could be?
NOTE: the extension is enabled in the php configuration file
The connection code is simple:
$host = "localhost"
$user = 'usuario';
$password = 'senha';
$db = ' banco';
$mysqli = new mysqli($host, $user, $password, $db);
if (mysqli_connect_errno()) {
print("Conexão falhou: %s\n" . mysqli_connect_error());
exit();
}
The return I get is:
Warning: mysqli::mysqli(): : Access denied for user 'usuario'@'localhost' to database ' banco' in /fakepath/arquivo.php on line 14
Conexão falhou: %s Access denied for user 'usuario'@'localhost' to database ' banco'
Does the user have permission in this bank? Local permissions, remote access permissions, etc. Pq vc does not try to log in with root to review permissions?
– ShutUpMagda
Yes. All permissions. I checked here, Even when I do normal access, console, via ssh, I can do DDL and DML normally. mysql remote is also enabled. The only one that does not work is mysqli...
– Edenilton Michael
Probably your problem is this: http://answall.com/questions/5303/query-mysql-em-php-s%C3%B3-works locally
– Bacco
When I mention remote mysql, I say that permissions for script connection on another machine is also enabled. The mysql service is running on the server but I can connect it from another location, setting mysql remote. Ok. when I speak in ssh I say I can use with the mentioned user and the database I am trying to access by php. It just doesn’t work in PHP. I’m looking into
– Edenilton Michael
I solved the problem! Something strange that I had not yet passed... I thank you for the tips. I will post how I solved.
– Edenilton Michael