2 Methods To Import A MYSQL Database

Import a MYSQL Database: If you are a regular visitor to this blog, you will notice that for some time now, I have started talking more and more about server management.

2 Methods to Import a MYSQL Database
2 Methods to Import a MYSQL Database

In this article, I will tell you about 2 methods to import a very large database.

Usually, for the transfer of a database from one server to another, I connect to PhpMyAdmin, I export the file from the first server to my computer, finally on the second server, I import it. It worked wonders with 2.5, 7 MB, etc. databases.

2 Methods to Import a MYSQL Database

Recently, I had to import a database of almost 150MB, and the above method was unsuccessful, I spent a sleepless night searching and finally I found two methods to import a database large data:

  • Importing a DB with the console,
  • Import of a DB with the BigDump script.

For both methods, you should first create a database and write down the comic book name, user name and password.

How to import a large DB sql with the console

Here I am talking about the linux console, as it is the most used operating system on servers. Under Windows, to manage a Linux server, you must havePuTTY.

To import a database via SSH with the console, you must first upload the .sql file to the server, then connect to the server with PuTTY, and execute the following command:

mysql -uUSERNAME-pPASSWORDDATABASE<file.sql

Replace:

  • USERNAME by comic book user name
  • PASSWORD by password
  • DATABASE by the name of the comic strip
  • sql by the name of your sql file.

Note: You must go to the directory where you uploaded the database and finally execute the command.

How to import a database with the BigDump script

  • Download the BigDump scripthere, decompress it with WinRar for example.
  • Open the BigDump.php file with a text editor and complete the following information:
  • $ db_server = ‘localhost’; // server address
  • $ db_name = ”; // name of the comic
  • $ db_username = ”; // username
  • $ db_password = ”; // password
  • Upload the BigDump.php file to the same directory as the sql file. And access the BigDump with a browser (ex: http://monsite.com/bigdump.php).
  • Click on “Import” to start the import

If you have any issues importing the database, comment us in the comment box.

Leave a Reply

Your email address will not be published. Required fields are marked *