If you are trying to load your live website on localhost and unable to upload large .sql
file to phpmyadmin
this post is going to help you solve this problem. I myself have faced this problem and after trying some options, I was able to solve it.
First download required files from the live server. The database file lets say is your_database.sql
and required wordpress website files is in the folder your_website
. Start Apache and Mysql modules on Xampp control panel, then visit localhost/phpmyadmin
. Create new database name your_database
and after selecting it, try to import the your_website.sql
file. You will see a message, as shown in the picture below, indicating that the file is too large to upload. I suppose you have faced the similar situation and looking for the solution.
The phpmyadmin gives a message if you try to upload large file. This makes it difficult to import large .sql
file to phpmyadmin
If you visit the documentation link in this message , it says to check upload_max_filesize
and post_max_size
values in php.ini
file.
You can update the value of upload_max_filesize
to 100M
and post_max_size
to 101M
in php.ini
file inside C:\xampp\php
directory.
But, it has not worked for me as I was still unable to upload the files. Still it is good to increase these values. I went for command line solution which worked great.
Run the following commands.
cd C:\xampp\mysql\bin
mysql -u root -p -h localhost -P 3306
It will ask for password, in my case it was empty. Most probably in your case as well it will be empty. I guess by default, XAMPP sets up a MySQL server with a root username and empty password. So, just hit enter. If it does not work you can check user and password name in C:\xampp\phpMyAdmin\config.inc.php
file
Once you are inside mysql server, you can select the database to which you want to upload the .sql
file. Let’s say your database name is your_database
. Run the command Use your_database
to select the database.
Once database changed, run the command source C:/Users/codingissimple/Desktop/your_database.sql;
to upload .sql
file to database. In this command, don’t forget to replace the path with your_database.sql
file’s original path. Finally, it got uploaded. You can verify by visiting localhost/phpmyadmin
The full process looks like below.
C:\Users\codingissimple>cd C:\xampp\mysql\bin
C:\xampp\mysql\bin>mysql -u root -p -h localhost -P 3306
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.4.28-MariaDB mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> USE your_database;
Database changed
MariaDB [your_database]> source C:/Users/codingissimple/Desktop/your_database.sql;
I hope you were able to upload your database file by following instructions on this blog.