Home  >  Article  >  Database  >  How to Import Large SQL Files into phpMyAdmin When Facing Upload Size Restrictions?

How to Import Large SQL Files into phpMyAdmin When Facing Upload Size Restrictions?

Patricia Arquette
Patricia ArquetteOriginal
2024-10-27 05:24:29976browse

How to Import Large SQL Files into phpMyAdmin When Facing Upload Size Restrictions?

Importing Large SQL Files into phpMyAdmin

Importing large SQL files into phpMyAdmin can encounter limitations due to the application's upload size restrictions. To overcome this issue and import files that exceed the supported size, consider executing the import from the MySQL console using the command line.

Solution:

  1. Connect to the MySQL console:

    • Open a terminal or command prompt.
    • Navigate to the directory where your MySQL binary is located (typically in /usr/local/mysql/bin).
    • Establish a connection to the MySQL console using the following command:
    mysql -u [DB-USER-NAME] -p [DB-NAME]

    Replace [DB-USER-NAME] with your database username and [DB-NAME] with the name of the database you want to import the data into.

    You will be prompted to enter your password.

  2. Import the SQL file:

    • Navigate to the location of the SQL file you want to import.
    • Use the < operator to redirect the contents of the file to the MySQL console, specifying the path to the file:
    < [db.file.sql path]

    Replace [db.file.sql path] with the full path to your SQL file.

  3. (Optional) Specify the host:

    • If your MySQL database is located on a remote server, use the -h flag to specify the hostname:
    mysql -u [DB-USER-NAME] -h [MySQL-SERVER-HOST-NAME] -p [DB-NAME] < [db.file.sql path]

    Replace [MySQL-SERVER-HOST-NAME] with the hostname of your remote server.

The above is the detailed content of How to Import Large SQL Files into phpMyAdmin When Facing Upload Size Restrictions?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn