All Products
Document Center

"SELECT command denied to user 'username '@' ip' for table 'user '" error when using apsaradb RDS for MySQL

Last Updated: Sep 07, 2020

Problem description

When the program is using RDS MySQL to execute a query SQL statement, the following error is reported. How to troubleshoot?

SELECT command denied to user 'username '@' ip' for table 'user' 



The database name is "fnb", and the program mosaic is er, database name mosaic error is caused by the error.



Alibaba Cloud reminds you that:

  • When you perform operations that have risks, such as modifying instances or data, check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • Before you modify the configurations and data of instances including but not limited to ECS and RDS instances, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted security information such as the logon account and password in the Alibaba Cloud Management console, we recommend that you modify such information in a timely manner.
  1. Test whether the RDS instance is abnormal. You can use the MySQL client to connect to the RDS and query the corresponding tables. If the query is normal, the RDS is normal.
  2. Use Wireshark to capture packets and capture actual requests sent by the local machine.
    1. In the Wireshark interface, Select capture > options on the input tab, select the network interface controller of the RDS instance, enter the output name, and then click start.
    2. Then, reproduce the problem. After the problem recurs, stop capturing the packet.
  3. Open the generated packet capture file, enter mysql in the display filter, filter the MySQL protocol, and find the package with the error.
  4. Click the right click, Select tracing stream > TCP flow.
  5. Check the SQL statements you sent to confirm that a database name splicing error occurred. Correct the database name and solve the problem.


Problem summary

  1. Check whether the program syntax and the syntax sent to the server are semantically correct.
  2. The SQL text to which the captured packets were analyzed.


Application scope

  • Apsaradb for MySQL