用户无法执行选择错误1142

时间:2012-05-24 08:55:15

标签: mysql phpmyadmin

我的phpmyadmin或MySQL命令行不允许我执行以下查询:

SELECT customer.First, customer.Last, login.Username, login.Password, customer.Addrln1,
    customer.Addrln2, customer.Postcode, customer.County, customer.Country, customer.Phone, customer.Email, 
    employee.EmpFirst, employee.EmpEmail, move.MoveID, move.CityOrig, move.CityDest, move.CountryOrig, 
    move.CountryDest, move.EnquiryDate, move.Surveydate, move.QuoteDate, move.DepEst, move.DepAct, move.ArrEst, move.ArrAct,
    move.ClearEst, move.ClearAct, move.DelEst, move.DelAct, move.Port, move.Method, move.Status
FROM customer
LEFT JOIN oim2.login ON customer.CustID = login.CustID
LEFT JOIN oim2.move ON customer.CustID = move.CustID
LEFT JOIN oim2.employee ON move.EmpID = employee.EmpID
WHERE customer.First =  'dave' and customer.Last='smith'

1142 - 对表'login'的用户'oceanai3'@'localhost'拒绝SELECT命令

Dave smith只是一个名字和姓氏的示例,用户可以执行以下查询:         从登录中选择*         SELECT * FROM move         SELECT * FROM customer

如果我从原始查询中删除了登录的引用,那么我会得到错误#1142 - SELECT命令被拒绝用户'oceanai3'@'localhost'用于表'move'。我已经粘贴了db的完整sql文件,可以在这里找到:http://pastebin.com/H6aTS74m 我已经浏览了很多其他人的帖子以找到答案,但我找不到任何帮助我的东西。

由于

C

2 个答案:

答案 0 :(得分:4)

GRANT SELECT ON database.* TO user@'localhost' IDENTIFIED BY 'password';

用您的值替换占位符。

答案 1 :(得分:0)

我认为,也许是Jivings的帖子:

GRANT SELECT ON database.* TO user@'localhost' IDENTIFIED BY 'password';

可能需要用户周围的单引号,如:

GRANT SELECT ON database.* TO 'user'@'localhost' IDENTIFIED BY 'password';

至少,这对我有用,但我使用的是phpMyAdmin 3.5.2.2。尽管如此,如果这可以帮助某人,那就非常重要:)