So I got a new box, installed fedora 25, configured everything I wanted… but was having a pain in the ass time migrating my WordPress sites to the new one. ~Insert moving sucks joke.
I’m no linux expert by any stretch, but I most of the issues was with the sql databases, as I was using phpmyadmin but error’ing out due to the size of the db’s and the gui just not doing what it was supposed to. This was the easiest way I was able to do it was in command line following these steps
- On the old server your moving from… export the sql database for the WordPress site your moving and also download the wp-content directory. Put these in a directory on your new server… I stuck them in /var/www/tmp/oldwordpress.sql + /var/www/tmp/wp-content_OLD
- On the new server Setup a new black clean WordPress install directory and attach it to a clean db. We will eventually move / delete these but I setup a clean new WordPress site to eliminate any unknown issues and know that WordPress is running correctly when installed fresh.
- Ok… so now the files we need are on the new server and its just a matter of importing and placing them where they need to go. Lets create a new sql database doing the following… assuming you have an sql root password already setup… if not you can google how to set that up on most “installing WordPress” tutorials. Bold text such as mywpsite should be changed to what you want it to be named…
sudo mysqladmin create mywpsitedb -u root -p
sudo mysql -D mysql -u root -p
MariaDB [mysql]> GRANT ALL PRIVILEGES ON MYWORDPRESSDB.* TO 'SQL_USERNAME'@'localhost' IDENTIFIED BY 'PASSWORD';
MariaDB [mysql]> FLUSH PRIVILEGES;
MariaDB [mysql]> QUIT;
Ok… so now we’ve created a DB and an SQL user name and password… lets import our old sql tables by navigating to that file directory and manually importing them… remember to change bold text to your actually file names and credentials
mysql -uSQL_USERNAME -pPASSWORD DATABASE < oldwordpress.sql
all your old tables should be associated with your new database now. Next step is to import all the content to the new WordPress install you have.
yes | cp -R /var/www/tmp/wp-content_OLD/* /var/www/newwordpressdir/wp-content
now edit the wp-config and change the values to point to the new database with the credentials you setup
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
/** MySQL database username */
/** MySQL database password */
last thing is to make sure you change ownership of the wp-content directory to apache if its not already.
chown apache:apache -R /var/www/newwordpressdir/wp-content
hopefully that works now, it did for me… you should be able to login and see all your plugins, themes, posts, etc working as it was on your old server.