Monday, May 19, 2008

Export and Import very large mySQL databases using UNIX commands

Here are the instructions to export your mySQL database into one file on the UNIX command line:

  • login to your web site using telnet
  • navigate to the directory where you want to store your extracted database file
  • run the following on the command line:
    mysqldump -a -u USERNAME -p DATABASE > FILENAME.mysql
  • check the size of your file (command: ls -al)
  • gzip your file to make the download faster using the command: gzip FILENAME.mysql
  • download your file in ftp to your local pc to upload and import into your new database

Now, For to do a manual import of your mysql file into current database:

  • upload your mysql file to your new web site
  • create a new blank database using myPHPAdmin
  • note your database username and password, and your mysql servername
  • unzip your database file with this command: gzip -d FILENAME.mysql
  • run the following on the command line to import:
    mysql -u USERNAME -p DATABASE <>
  • check your database in myPHPAdmin to make sure all the tables imported properly

Share or Bookmark it:

0 comments: