insert command denied in mysql

后端 未结 7 1237
天涯浪人
天涯浪人 2021-01-17 07:41

I have a database table from which, when I select data with username and password, it works but when I insert some data in that table with same username and password it show

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-17 08:07

    This is a permissions problem. Log into a MySQL prompt with the user the app is running as, and enter this query:

    SHOW GRANTS;
    

    This will show you the privileges (grants in MySQL-speak) that the current user has. My guess is that you won't see INSERT privileges for the given table. You will need the root user to grant you permission by running this query:

    GRANT INSERT ON 'db'.'tablename' TO 'username'@'localhost'
    

提交回复
热议问题