Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql CREATE VIEW not working from mysql_query

I have a code to create VIEW in mysql database which is working fine on my local server. It creates and crop view normally. But on my Online server it gives error

"CREATE VIEW command denied to user"

for online database I manually create VIEW in Database form PHPmyAdmin [Myadmin is in localhost online] it creating, SO i have permission to create VIEW on online database.

But with php mysql_query it is giving command denied error. is there any service to be on for creating view with php.

like image 426
Naresh Avatar asked Sep 10 '10 06:09

Naresh


1 Answers

This message says that user doesn't have enough permissions to create view. Permissions are granted to particular user @ particular host. You must execute

GRANT CREATE VIEW ON *.* TO 'username'@'host'; 

where host is hostname from where your CREATE VIEW is executed

Also, user must have SELECT privilages on all tabels and columns involved

like image 160
Ljubomir Đokić Avatar answered Sep 28 '22 08:09

Ljubomir Đokić