Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 救!sql文件迁移TiDB 连接到TiDB时报错
[Test Environment for TiDB] Testing
[Encountered Issue: Problem Description and Impact] When using TiDB Lightning for migration in the company’s test environment, the configuration file was set with the IP and user information of the test environment’s TiDB cluster. However, an error occurred during the migration. The specific details can be seen in the log screenshot. The log shows that access was denied, but the IP mentioned is not my TiDB’s IP; it is the IP of my current environment.
[Resource Configuration] Navigate to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
First, use the MySQL command to check if the username and password are correct.
The existing SQL file is used to migrate to TiDB, but the IP address in the log connection refusal is different from the TiDB IP I configured. I don’t know why. The TiDB username and password are correct.
Did you use HAProxy as a proxy?
There might be an issue with the configuration file address.
Check the original configuration file before migration; there must be a mistake in the configuration or something that hasn’t been modified.
Thank you, I found that the password in the configuration file was entered incorrectly.
This error must be due to incorrect username or password.
First, log in to the client from the machine where lightling is located and check show processlist;
to confirm the host
field.
MySQL displays users like this, treating the user and host address as the user. TiDB is the same as MySQL, showing the IP of your host is correct. It would display the same way if you failed to log in using the MySQL client.
Since it is an SQL file, the simplest method is to directly log in to the TiDB database using the MySQL client and then source this SQL file.
Make sure the username and password are correct (preferably not hard-coded in the code).
In addition to verifying the password, you should also check if your root has IP restrictions. If the host is %, it means there are no restrictions.
SELECT user, host FROM mysql.user WHERE user='root';
First, connect to TiDB to confirm whether this user exists.
First, the password is incorrect. Second, there is no permission. Generally, these are the two issues.
Username and password error minor issue