MySQL Import 1290

Introduction

In MySQL, the mysqlimport command is used to import data from a file into a MySQL database. However, sometimes you may encounter an error with code 1290. In this article, we will explain what this error means, why it occurs, and how to fix it.

Understanding Error Code 1290

Error code 1290 is related to the server's secure configuration. It indicates that the MySQL server is running in secure mode, and it requires an encrypted connection to upload files using mysqlimport. This error is thrown to ensure the security of data transfer.

When you execute the mysqlimport command without specifying the secure connection, you will encounter error code 1290. However, there are ways to overcome this issue.

Solution

To fix error code 1290, you have two options - either enable the secure connection or disable it. Let's explore both options in detail.

Option 1: Enable Secure Connection

To enable a secure connection, you need to specify the --ssl-mode option when running the mysqlimport command. The --ssl-mode option has four possible values:

  1. DISABLED - This is the default value where the secure connection is disabled.
  2. REQUIRED - This value enforces a secure connection. If the server does not support SSL or the connection cannot be established, an error will occur.
  3. VERIFY_CA - This value requires a secure connection and also verifies the server's certificate.
  4. VERIFY_IDENTITY - This value requires a secure connection, verifies the server's certificate, and also checks if the server's hostname matches the certificate's common name.

To enable a secure connection with the --ssl-mode option, use the following command:

mysqlimport --ssl-mode=REQUIRED -u <username> -p <password> <database> <file>

Replace <username>, <password>, <database>, and <file> with your actual credentials and file details.

Option 2: Disable Secure Connection

If you don't have the server's SSL certificate or you don't want to use a secure connection, you can disable it by modifying the MySQL server's configuration file. Follow these steps to disable the secure connection:

  1. Open the MySQL server's configuration file, usually named my.cnf or my.ini, depending on your operating system.
  2. Locate the [mysqld] section in the configuration file.
  3. Add the following line under the [mysqld] section to disable the secure connection:
[mysqld]
require_secure_transport=OFF
  1. Save the changes and restart the MySQL server for the changes to take effect.

After disabling the secure connection, you can use the mysqlimport command without specifying the --ssl-mode option, like this:

mysqlimport -u <username> -p <password> <database> <file>

Replace <username>, <password>, <database>, and <file> with your actual credentials and file details.

Conclusion

Error code 1290 in MySQL import indicates a secure connection requirement. To resolve this issue, you can either enable the secure connection by specifying the --ssl-mode=REQUIRED option or disable the secure connection by modifying the MySQL server's configuration file.

By following the steps mentioned in this article, you should be able to resolve the error code 1290 and successfully import data into your MySQL database using the mysqlimport command.

Remember, enabling a secure connection is recommended for enhanced data security, but if you don't have the necessary SSL certificate or specific requirements, you can disable it.

I hope this article has helped you understand and resolve the MySQL import error code 1290. Happy coding!

Sequence Diagram

The following sequence diagram illustrates the process of importing data using mysqlimport command with a secure connection:

sequenceDiagram
    participant Client
    participant Server
    participant MySQL
    
    Client->>Server: Run mysqlimport command
    Server->>MySQL: Connect to MySQL server with SSL
    MySQL->>Server: Authenticate connection
    Server->>MySQL: Import data from file
    MySQL-->Server: Data imported successfully
    Server-->Client: Import process complete
Table

The following table demonstrates the usage of the mysqlimport command with different options:

Command Description
mysqlimport -u username -p password db1 Import data into the default table of the db1 database using the specified username and password.
mysqlimport --local -u username -p db1 Import data from a local file into the default table of the db1 database using the specified username.
mysqlimport --columns=col1,col2... Import data and specify the columns to be imported.
mysqlimport --ignore Import data and ignore duplicate records.
mysqlimport --delete Import data and delete existing records before importing.

References

  • [MySQL Documentation: mysqlimport](