SELECT command denied to user ''@'localhost' for table 

I was engaged in data transfer to the form, before that on other forms the base was used normally (the user is root), well, now this error climbs and the base is not used normally

Request:

 $sql='select a.id , b.city_lng, b.city_lat from homeplus.t_city as a, homeplus.t_city_coord as b where a.id =b.city_id and a.city_name_rus="'.$city_name.'"'; $res=mysql_query($sql) or die (mysql_error()); 

File connectDB.php

 function OpenDB(){ //$vDB=mysqli_connect("localhost","root","iq2k47","homeplus_test1"); $vDB=mysqli_connect("localhost","root","","homeplus"); if(!$vDB){ die("Connect error (".mysqli_connect_errno().") ".mysqli_connect_error()); } mysqli_set_charset($vDB, "utf8"); return $vDB; } 
  • show request ... - Gorets
  • Problems with the request. Everything that worked before and did not touch this page flew because of it. I returned everything back, I deleted the request, I did it a little differently - it works - I LIVE

1 answer 1

Lectures that root can only be used in the denver on your home computer, you probably already read more than once.

Log in to phpmyadmin, users, privileges. See what the user root. Most likely, daws are removed, opposite the select command (or some other).

The error literally means that the given user (root) is given the command (select) for this table (is it not information schema? =)) Can not be used: there are no rights.

  • @knes, I use only on my home computer. Went in, there are already three root, but everyone has a tick on everything - LIVE
  • I also want to note that the water error should be like this: SELECT command denied to user 'root' @ 'localhost' for table, but I have no username, although I connected to the database as root. - I ’m living
  • Why do you need so much? =) "extra" pudal. Leave only the very first one that has the lowest ID. It is in any case that the system is not lost. - knes
  • It sometimes happens, the root does not write. This is Denver's bug =) STOP. and the file of a connection is connected to this file to a DB or at once there is a request? - knes
  • You need a connection file (You can with a smeared password), a piece (+3 lines), where the file is connected, a piece where the request goes (+3 lines), PHP errors. at the beginning of the file add: error_reporting (-1); ini_set ('display_errors', '1'); - knes