It was a bit like a monkey typing Shakespeare, but I did it !!!
Situation:
Initial setup: single domain, single hosting
Wordpress installed under a “WP” folder to avoid clashes with previous webpage setup for my website.
public_html/WP/ or http://www.philuxphoto.ca/WP/
The destabilizing event was moving the domain http://www.philuxphoto.ca to new hosting. In particular shared hosting.
From the FTP point of view things look now like this:
(2) public_html/philuxphoto.ca/WP/ but from the outside it still looks http://www.philuxphoto.ca/WP/
I backed up the old wordpress instalation folder and exported the database, from phpMyAdmin ( cPanel ) to my own computer.
Of course when I tried to get it going again, on my new hosting, it wouldn’t work. I would get errors about the database, nothing will load after overwriting a fresh install of wordpress with my old wordpress.
I wasn’t able to load my old database into the new PHPMyAdmin, I would get a 1044 error.
First I’ve learned that I need to modify my database a bit:
(1) I modified this in my original database ( using a text editor ): commented out two lines ( by placing two dashes in front of the commands — ) these lines should be at the beginning of your file, first 100 lines. Commenting out means that whoever uses the file will ignore that those lines:
— CREATE DATABASE phi1519705110057 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
— USE phi1519705110057;
(2) To help myself I made a fresh install of WordPress, moved it to another folder “WP_Learning”.
I stole everything I could from there: how to configure wp_config.php,
(3) Under my MySQL Databases, rather than PHP MyAdmin, I created a new database, gave it a random name.
(4) I imported the edited database to my new random name database.
(5) eventually I renamed my new database in the form username_databasename
Use the same format you see in the functional WP install, look inside phpMyAdmin for this.
(6) This is what I did to the wp_config.php file ( based on (2) ) see below:
There are notes within the code below:
modified username_databasename, you will find it with (2)
define('DB_NAME', 'username_databasename');
This looks very much like the above, but it’s the username still
you will find it with (2)
/** MySQL database username */
define('DB_USER', 'username');
xxxxxxxxxx is some encrypted password
you will find it with (2)
/** MySQL database password */
define('DB_PASSWORD', 'XXXXXXXXXXXX');
Sometimes the database is hosted somewhere else and it looks like this phi1519705110057.db.5805708.hostedresource.com ( you should replace the localhost below with it )
Again you will find what you need with (2)
/** MySQL hostname */
define('DB_HOST', 'localhost');
Some notes follow inside the wp_config.php
Then there is this:
xxxxx and so forth, are keys that I copied from another existing wordpress database, a functional – legitimate one that was created just to learn, steal, from it everything I could
Again you will find what you need with (2)
define('AUTH_KEY', 'XXXXXXXXXXX');
define('SECURE_AUTH_KEY', 'YYYYYYYYYYY');
define('LOGGED_IN_KEY', 'ZZZZZZZZZZZ');
define('NONCE_KEY', 'UUUUUUUUUUU');
define('AUTH_SALT', 'PPPPPPPPPPP');
define('SECURE_AUTH_SALT', 'VVVVVVVVVVV');
define('LOGGED_IN_SALT', 'CCCCCCCCCCC');
define('NONCE_SALT', 'NNNNNNNNNNN');
TO Summarize:
Old database needs to be loaded inside phpMyAdmin
Get it’s name inside wp_config.php correctly.
steal credentials from a legitimate working wordpress wp_config.php ( keys, users )
You may need to do other stuff to get your old WP working again.
In my case I was lucky enough that wordpress install didn’t really get confused by the nested structure, as I have now with shared hosting. Also, a bit of a nudge form the forums helps.
Hope this useful to someone, take my advice with a grain of salt. I’ve never touched a MySql database until 2 days ago.