I want to import a big sql file in V4. in V3 I used msql dump but now I don’t know how to import. I tried with adminer, phpmyadmin, it doesn’t work.
Can you give me a solution?
Disclaimer: I’m yet to test it in my box.
Just tested the command and imported a 200mb+ sized db.
in V4, MariaDB is installed as a docker container named ee-global-db
. You need to find the DB detail of your site using ee site info
command. and then docker exec -i ee-global-db mysql -udbuser -pdbpass --database=dbname < dump.sql
Dont forget to replace dbuser, dbpass and dbname with your info. also mind that there is no space between -u, -p flag of the command.
Source: http://depressiverobot.com/2015/02/19/mysql-dump-docker.html
This is a snippet of my working v4 restore code:
domain=example.com
dbfile2=database.sql # assume /opt/easyengine/sites/example.com/app/database.sql
db_user=`ee site info $domain | grep 'DB User' | awk -F '|' '{print $3}' | awk '{print $1}'`
db_password=`ee site info $domain | grep 'DB Password' | awk -F '|' '{print $3}' | awk '{print $1}'`
db_host=`ee site info $domain | grep 'DB Host' | awk -F '|' '{print $3}' | awk '{print $1}'`
db_name=`ee site info $domain | grep 'DB Name' | awk -F '|' '{print $3}' | awk '{print $1}'`
ee shell $domain --command="mysql -h $db_host -u $db_user -p$db_password $db_name < ../$dbfile2"
Well if you want to import a DB file, this is the most simplest I’ve found(assuming it’s a WP site):
mv db.sql /opt/easyengine/sites/example.com/app/htdocs/
ee shell example.com --command='wp db import db.sql'
I didn’t think to check wp for a db import command. Much cleaner. I would like a --format= added to ee site info.
Yes. That’s what I use.
Ok noob question here. I am moving from shared hosting to a VPS.
1.I suppose the mySQL exported file I have will yield no problem importing into MariaDB right?
2. How do I import the wp-content folder? Since everything is in a docker instance I have no idea where to upload this via FTP now. Is there a guide or something similar where I can find some info about this? Please point me in the right direction
Thank you
Ok I was reading the filesystem doc and I think I know where it goes now.
There is a broken link here btw
in the 4th or 5th paragraph there is a mention of the sites filesystem that takes u nowhere
Anyway, now my problem is. How do I upload a wp-content folder that is over 1 gb. Is filezilla ftp the best option? or can u recommend something better. Sorry for such noob questions I just want to migrate my site to something more powerful a VPS running EE4
I tried to use ee shell $domain --command="wp db export $dbfilename"
with a script in the /etc/cron.daily folder. I am getting an error “the input device is not a TTY” only when cron runs the backup script.
take a look here https://stackoverflow.com/questions/43099116/error-the-input-device-is-not-a-tty maybe it helps you
I’ve fixed it.
Thank you for reporting
I tried to use
ee shell $domain --command="wp db export $dbfilename"
with a script in the /etc/cron.daily folder. I am getting an error “the input device is not a TTY” only when cron runs the backup script.
That’s because if you’re using EEv4 and you want to run crons, you should ee cron
command to ensure your cron runs correctly inside docker containers.
Have a look at - https://easyengine.io/handbook/cron/ for more info on this.
OK Thanks I will check it out. I was able to get around the problem with this script:
docker exec ee-global-db bash -c "mysqldump --no-create-db --opt --add-drop-table -Q -h $db_host -u $db_user -p$db_password $db_name" > $tmp/$dbfilename
Closing this thread as original question has been answered