Problems with PHP connecting to Mysql

phpstudy configuration apache and mysql display enable the service, and the command line connection can also be connected, but the following statement shows that the connection cannot be made in php:
$con = mysqli_connect ("localhost", "root", "root");
if ($con)
{
die ("Could not connect.". Mysqli_errno ($con));
}
) always shows what other possible locations are errors under Could not connect, advice?

Php
Mar.21,2021

if(!$con)
{
    ...
}
if,false,

replace mysqli_errno ($con) with mysqli_connect_error () , output error details


this is too many possible cases
1. Your account password is incorrect
2. Maybe the default port of your mysql is not 3306
, so you can follow your brother upstairs to use mysqli_connect_error () to get the details of the link error.


shows that this Could not connect shows that $con is a resource returned by true,. Of course, it is true, your logic, convinced

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38517-2b87f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38517-2b87f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?