DataBase user don't have privilege

Website URL

(http://test-stiwears.000.pe/)

Error Message

I received an error which said i dont have privilege for some commands in sql
Im using free plan since it just a test run for my school project

Fatal error : Uncaught mysqli_sql_exception: SELECT command denied to user ‘if0_37296747’@‘192.168.0.37’ for table user_account.cart in /home/vol1_7/infinityfree.com/if0_37296747/htdocs/cart.php:15 Stack trace: #0 /home/vol1_7/infinityfree.com/if0_37296747/htdocs/cart.php(15): mysqli->prepare(‘SELECT c.id, i…’) #1 {main} thrown in /home/vol1_7/infinityfree.com/if0_37296747/htdocs/cart.php on line 15

Please read

2 Likes

im pretty sure that im using right credentials when connecting the database into my project
the error here is the user privillege which stated that i dont have an access to use specific command like select etc

my question is does the free plan dont have enough privilege for that or how can i grant those privilege so my porject work properly with my db

hehe my bad sorry just misunderstood the error i thought i had a problem with the connection of db cause it keep saying i dont have privilege for specific command but then i realized i need to change all database name in my sql queries. such an amazing discovery

For the maximum compatibility of your website, you could also just not specify the database name in the query. So instead of doing SELECT ... FROM user_accounts.cart, you could also just do SELECT ... FROM cart. Then you only need to specify the database name when creating the database connection, and MySQL will just use the table from the current database.

The error says SELECT command denied, because your database user is not allowed to access any database called user_account. No such database exists of course, because all database names are prefixed with account usernames, but MySQL won’t tell you because you’re not supposed to be able to know whether someone else’s database exists or not.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.