Sometimes while running WP-CLI commands, you will get following error
Error establishing a database connection
So this can be fixed by very simple method. Please watch the video for how to fix that.
Sometimes while running WP-CLI commands, you will get following error
Error establishing a database connection
So this can be fixed by very simple method. Please watch the video for how to fix that.
Sometimes using phpmyadmin, it’s kind of impossible to import DB from the import section. So below is the command to import large DB into MySQL.
Step-1 Login to MySQL using following command
/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot
Step-2 Select DB in which you want to import DB
use DB_NAME;
Step-3 Import DB
SET autocommit=0 ; source PATH_TO_YOUR_SQL_FILE.sql ; COMMIT ;
That’s it.
Don’t forget to change path!!!
Video for who doesn’t like to read ;). And if you like the video then subscribe my channel and share this with others who has the same issue.
When I was working on the local development, I had an issue as shown in this post image.
When I tried to import a database from PHPMyAdmin, I was having the error “413 Request Entity Too Large“.
After searching a bit on the internet, I found a very simple solution. It would take only a couple of minutes.
So as this is nginx related error, open your Nginx config file. In my case, I was using MaMP. So my nginx.conf file was at this location:
/Applications/MAMP/conf/nginx/nginx.conf
Open the file and add the following lines into http { }
section as shown in below image:
client_max_body_size 1000M; fastcgi_read_timeout 3600;
After adding that line, try to restart Nginx.
In my case, I had a button to restart the server in MaMP. You might run the command like service nginx restart
While importing big database in MySQL, you might get the error as shown below:
ERROR 2006 (HY000) at line 3387 in file: 'path_to_the_db_dump.sql': MySQL server has gone away
Step 1:
Open a terminal and find a config file for MySQL by command locate my.cnf
.
You will get the list of files. Open your responsible file.
If you don’t know the responsible file then open all the files ;). There is no harm to add our solution in all the related config file.
Step 2:
Add following line to my.cnf file.
max_allowed_packet=64M
Restart your MySQL using below command.
sudo service mysql restart OR brew services restart mysql
That’s it!!!!
Sometimes you get the below error while importing the database.
ERROR 1031 (HY000) at line 5643 in file: '/Users/username/Downloads/database.sql': Table storage engine for 'table_name' doesn't have this option
Now let’s fix this.
Step – 1
Open your sql file in your favourite editor and go to SQL query of that table.
You will see ROW_FORMAT=FIXED
at the last of the query and remove that.
Step – 2
Save your file and try to import the database. This should fix the error.
That’s it