Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Still not good at Migrating WordPress websites

But I remain undeterred :)

I've deleted all the databases I have on my host server and I'm going to have another go tomorrow. Fresh start.

I use XAMPP for localhost and cPanel for my host server both use phpMyAdmin. Remember I'm also trying to add it to my domain add on for my website so http://www.jonniegrieve.co.uk/wordpress-jonniegrieve.co.uk rather than just jonniegrieve.co.uk.

But rather than just following the video this time from the local wordpress development course, it might be worth trying using other sources.

Can anyone recommend any that might help me get round this brick wall I'm in? :)

3 Answers

Kevin Korte
Kevin Korte
28,148 Points

So where you stuck at?

  1. Basically export your local database sql file
  2. Import SQL file into host database (and use cPanel's phpmyadmin to verify if you want)
  3. Create your database user with read/write access on host
  4. Create your folder in your public_html host folder. In your case your folder name would be *wordpress-jonniegrieve.co.uk *
  5. FTP your wordpress files into the new folder
  6. Change your wp-config.php file to reflect hosts database connection.

Basically there. There are some details left out that Wordpress covers. Does this help? https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Kevin,

Where I get stuck is the point where I've imported the sql file and have to edit the config file. When I tried again today, wp_login showed up but wouldn't accept the new user details. So something is wrong in my process but I can't be sure what,

I did notice that I had to edit my imported sql file so phpmyadmin on my server could actually import the backup database. I had to change the username detail in the database towards the top. Zac didn't have to do that.

The domain add on is accessible as a folder in my server so that exist. The child directly is a cgi-in. The Wordpress files go alongside (not inside) that folder.

Also I get the feeling I'll need an alternative to the search and replace plugin once I've got in. :-)

Kevin Korte
Kevin Korte
28,148 Points

What did you change exactly? That might be why you can't log in.

And to clarify, an add on domain is like having myfirstsite.com and mysecondsite.com on the same hosting account, but completely separate domain names. You're describing putting wordpress in a subfolder of your main domain in your first post, which is not an addon. I just want to clarify what your goal is.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

My web host calls them domain addons. They're like sub domains only they're a second level to the root directory and have their own suffixes. They share my space allocation with the root and have their own ftp information to login, of I can access them directly from the root. You can see this if you click my first link. As I write this now, it contains one cgi-bin folder,

I can't tell you precisely what I changed as I'm away from the computer after a long day but I simply changed the reference to the localhost username to the username I set up via my web host. I had to do this twice before phpmyadmin would import the file..

But it's in that folder/add-on I wan to put Wordpress

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points
-- phpMyAdmin SQL Dump
-- version 4.4.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Dec 08, 2015 at 06:35 PM
-- Server version: 5.6.26
-- PHP Version: 5.6.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `localwp`
--
**CREATE DATABASE IF NOT EXISTS `localwp` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `localwp`; **

This is the bit where I changed the information in the localwp.sql... exported and imported in phpmyadmin.

One thought is that if I have to change the site URL in config.php... Do I not need to do the same for the sql file?

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

I may have figured out what's been going wrong.

I was unsuccessful, again in migrating the site over to my server. but I noticed this time that some of the files from wp-admin and some from the wp-includes haven't actually transferred over. Filezilla say it's a critical disk error - disk, full which I find very odd because there is plenty of space on my folder. I didn't notice this yesterday, whether it's because it didn't happen or I missed it, I'm not sure but it makes sense.

Also I was able to import the sql file first time without having to change it, and with fewer sql queries this time.

So right now, yet again this is all that's showing up on the site. http://www.wordpress-jonniegrieve.jonniegrieve.co.uk/

**Etiam Mollis Sit Gratt Spore.

Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo. Nulla vitae elit libero, a pharetra augue.

and a list of broken images**

Have a look at the steps I detailed in this thread https://teamtreehouse.com/community/does-the-free-version-of-serverpress-allow-you-to-push-your-local-site-onto-the-web

WP DB Sync does all the replacing of domain name and file path for you.

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Alright...

I've made some progress.

The reason the front page my website wasn't showing up was because there was a batch of HTML files in the root of my Wordpress installation. That is also why there was a list of broken images on the site. I also deleted the img folder that was there, making sure all the images I needed were in the wp-uploads folder. Once I did that, the front page for my site showed up!!

I also managed just now to log into the dashboard by wp-admin. Great!

Shouldn't I be able to do that though through my new mySQL details that I added? Sorry if that sounds like such an obvious question :)

Kevin Korte
Kevin Korte
28,148 Points

If I'm understanding your last question your SQL user you created on your host is how wordpress has credentials to update the wordpress.

When you log in via wp-admin, you're actually logging in with the credentials inside of the database. There are two different sets of credentials there. One you use, and one wordpress uses.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

I may need a little more practice then. I've got a proper note of the username and password I use to login but I can't really remember how I got that password and username in the first place. phpmyAdmin might have something to do with it. Once I'm up to date here I'll have a practice with another website.

There's one more question I have though if I haven't tried your patience enough already :)

I've run a search and replace plugin on the site twice now but my basic navigation still isn't working. I think it's still looking for index.php on my localhost. I've tried running the plugin on all tables in the database. I used Better Search Replace 1.2.9 by Expanded Fronts.

Many many thanks again!

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

I don't know how, or why, but the links on my main navigation are now working!!!.

I did look at my Search/Replace plugin one more time but I did dry runs that told me the tests I was making wouldn't have made any changes anyway. But right now, my websites links are all working and this saga is finally over. :D

Thanks again.