简体   繁体   中英

Access denied for user 'totallig_root'@'197.210.64.73' (using password: YES) when conneting to online database from localhost

I am trying to access my online database from localhost but gives the mentioned error. I tested it online and it worked.

Under Databases , I have added my computer ip address to Remote MySQL .

Access denied for user 'totallig_root'@'197.210.64.73' (using password: YES)

my connection strings

$host = 'totallightschools.com:3306';
$user = '******';
$pass = '******';
$db = '******';

$con = mysqli_connect($host,$user,$pass,$db);
if (mysqli_connect_errno())
{
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

If you have an MySQL user in your MySQL instance, with the name totallig_root and given password, which is allowed to connect from your host ( 197.210.64.73 ) you should be able to connect with this function:

mysqli_connect($host,$user,$pass,$db,$port);

So you have to specify the port (if it's not the default port) in a seperate argument. The user in your MySQL instance should look something like this: totallig_root@197.210.64.73 or totallig_root@% (to allow to connect from all hosts)

Source: http://php.net/manual/de/function.mysqli-connect.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM