Importing big .sql files in MySQL

You can safely use PHPMyAdmin to export a database, just save it to a file on your computer.

Then use a program in WinSCP to upload that file to your Web Server.

Next, edit your /etc/my.cnf to include the following line:

set-variable=max_allowed_packet=64M

Then start the MySQL command console 'mysql -u root -p', and type 'source localhost.sql'

1 thought on “Importing big .sql files in MySQL

  1. curreri

    If you run show warnings after running a bunch of separate inserts, then you will only get warnings from the last insert.

    So, If you are running an import file with lots of discrete inserts, like from a mysqldump, then you will want to run the file this way to capture warnings.

    mysql –show-warnings -u(username) -p(password) (databasename) > (logfilename) 2>&1

    Here is an example:

    mysql –show-warnings -ucurreri -pXxXx23Xx2password census > edwdump2012.log 2>&1

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.