Knowledge Base
MilesWeb / cPanel

How to import MySQL tables using phpMyAdmin?

Approx. read time : 2 min

Here are steps to import tables using phpMyAdmin :

1. Log in to Manage MySQL tool.

2. From the Current MySQL Databases section, click on login name for a database to log into phpMyAdmin

3. Go to the left-hand side of the phpMyAdmin program window, and click on the database in which the table is present.

4. Click on the table that you want to edit in order to display the Structure page of the table.

5. Now click on Import.

6. In the section of File to import, click on Browse to select the file that you want to upload.

7. Now select the character set of the file.

8. Specify if you want to allow an interrupt of the import in case the script detects it is close to the time limit. This can be a good way to import large files, however, it can also break transactions.

9. Select the format of the file to be imported as per your choice.

10. If you are selecting a file with CSV format or CSV using LOAD DATA, then complete the options
fields :

• Replace table data with file: Select this check box, if you want the content of the file to be replaced with the contents in the database.

• Ignore duplicate rows: Select this check box if you want to import script in order to ignore duplicate rows present in the file.

• Fields terminated by: By default semicolon (;) is used, to separate the fields. You can enter characters that separate the fields.

• Fields enclosed by : Enter the character that stipulates field data.

• Fields escaped by : Here enter the character that can escape (omits) a line. For example, in PHP a line started with ‘//’ makes the server to skip that line.

• Lines terminated by : Enter the character that denotes the line break. You can also leave the default ‘auto’ entry that will automatically detect the line breaks.

• Column names: Enter names of only certain columns those you want to be uploaded.

• For CSV using LOAD DATA, set the Use Local keyword, as it is needed. If the local keyword is specified, then it is interpreted with respect to the client end of the connection.

When the LOCAL is mentioned, then the client program on the client host reads the file and sends it as it is to the server. And if the LOCAL is not mentioned, then the file must be located on the server host and is read directly by the server.

11. Now click on GO to import your file.

That’s it!

Also Read :

1)MySQL Triggers: What Are They and How to Use Them?

With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.
Need help? We’re always here for you.