I execute command in the client on C #

INSERT INRO database.tablename (column, column2, ...) VALUES (val1,val2,...) 

IDE crashes with exception: Additional information: INSERT command denied to user

Although I gave all the privileges to the localhost user.

And this is how it works, you need to remove the database name:

 INSERT INRO tablename (column, column2, ...) VALUES (val1,val2,...) 

The question is why? Why does the name of the base somehow overshadow the privileges?

Supplement from comments

In the mysql console client, syntax like this is not prohibited, and in MySQL Workbench it does not work without explicitly specifying the database.

  • one
    INRO? How does it work for you? - Zhukov Roman
  • It was sealed up, in manual wrote, but not copy-paste, in the code INTO it is written - BlackOverlord
  • Where in the INSERT syntax did you see the choice of database? mysql.ru/docs/man/INSERT.html - Zhukov Roman
  • Maybe you have a table with this name is in 2 DB. And in the current database you have rights, but there is no right in the explicitly specified database - Mike
  • one
    In mysql, this syntax is not prohibited, but in Workbench it does not work without an explicit indication of the database - BlackOverlord

1 answer 1

With correctly set permissions on the database both queries are correctly executed in the console client and in the MySQL Workbench. True in the last editor you need to closely monitor the installation of a connection from under a new user. If you do not specify the default database in the Default Schema field when creating a connection, the situation you described in the question arises: the query is not executed without explicit detail of the database name.

In the console client, you also cannot execute a query without specifying the database name unless you explicitly choose a database at the time of the connection or using the USE .