Repair a broken wordpress with shared hosting

Recently I migrated to a shared hosting connection for my entire website, one of the problems I encountered was that it broken all of the links to my MySQL databases

When I moved the directories and files, all I was consistently receiving was database connection not available.

The problem you have with shared hosting is that all the MySQL databases must be separated. So to do this, all hosting providers give your MySQL database a leading connection.

In the form of myself, my host gives all my database names andrewho_ (then the database name)
For my databases, they were called wordpress and zencart.

My new MySQL databases are called andrewho_wordpress and andrewho_zencart. The problem is you need to repair the connection when migrating to shared hosting connection with wordpress and it’s actually really easy

Here is how to fix the SQL database problems

1) Carry out an SQL dump of the entire database
You need to back up your entire existing database, for me it was hosted on my home PC. I had the MySQL Workbench installed, so it’s just a case of selecting the “Export” option, ticking your database. Giving it a name to identify it (ending in .sql) and saving to your computer

2) Create a new database from your hosting provider for the directory where you want to install it
Your wordpress needs to be reimported with phpmyadmin to recreate all the tables and data

3) Modify your .SQL file (so it doesn’t create a new database)
One of the major problems I encountered was every time I uploaded the file, it failed. This was because my user account didn’t have permissions to create databases with the names given by the SQL files. This is because you need to reimport the data with a modified SQL file using the new details

The quick way of doing this is to open your SQL file with Notepad++ or any text editor and comment out the lines and change the database names. I have given an example of this below so it’s easier to explain.

USE `wordpress`;

Note the highlighted entries, you need to comment out (–) the option to “create” the database… in this example it wants to create a database called “wordpress” (it’s already created)

Originally it was called “wordpress”, you need to change the database name so it knows where to import the data
USE `andrewho_wordpress`;

I had to modify both my files when uploading the data other wise it break the database.

4) Once you have uploaded the files, you need to modify the wp-config.php file otherwise it will just try fail to connect to the database. This is in the following directory

Here is an example of the details on my directory…..
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘andrewho_wordpress‘);

/** MySQL database username */
define(‘DB_USER’, ‘andrewho_myusername (eg root, admin)‘);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘My secret password‘);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

Dedicated server

Did a configuration change on the website and it brought me to something I really need to work on with the limitation of this webserver. Eventually I’m going to have to migrate to a dedicated server or build myself one


This lowly quad core PC is taking a lot of brunt. I did some changes and applied some programs with my cloudflare settings, my inbound connections on MySQL went from around 4-10 to nearly 500. The PC slowed down drastically because they I/O was taking a hammering


This is the perfect time to start building my cluster of PC’s. ┬áA bunch of low powered cluster computers acting as a dedicated server for my website will be faster than this PC as the load requests can be split up.

I’ll get some software and load test this PC, then find out the comparison with the new server I build

Watch this space ­čÖé

Cannot start session without errors in phpMyAdmin

A quick one, I recently received the message Cannot start session without errors in phpMyAdmin when trying to logon


Usually when you get this message it’s normally because of your browse cache, or an issue with the session.save_path variable in the PHP.ini configuration file


I decided to check the session save path first and it turned out after I had a problem with my PHP configuration. I updated PHP but forgot to copy over the directories


My PHP was pointing to a /tmp folder. Once I created this, jobs a good un. Remember this in next time

What can a computer handle?

With me hosting my own website and files, I’ve been asking a lot lately from my tiny old home PC.It’s custom configuration of Windows 7 Home Premium, 4GB Ram, Quad Core AMD CPU and a Western Digital Raptor Hard Drive.┬áThis got me thinking enough to ask the question, how much is too much. What can a computer handle exactly?

Currently this PC is running at 90% memory usage, and 100% CPU usage. So it’s safely close to maximum and probably swapping to the page file a lot at the moment


On this PC at the moment I’m doing the following

  • Running Google Chrome and Firefox (surfing web, website testing)
  • Playing youtube
  • Running a virtual machine for development (Windows 7)
  • Running a webserver (Apache, MySQL, PHP)
  • Running a backup software
  • Listening to windows media player
  • Running an exchange server
  • Recording a cctv feed
  • Running all background and host apps (antivirus etc)
  • Folding on all CPU cores with SMP client (folding at home) – 100%

So this little beasty is doing well to be honest. I can’t wait for the new build. How much is too much, enough until your PC calls quits. I’ll reward it with some increased hardware and being a controller of my newly built cluster when I make it

It’s safe to say computers have advanced so far you can easily run virtual machines with the simplest of hardware now and still chuck more at the computer



Repairing corrupted MySQL tables

OK, so whilst using my stats monitoring software (tracewatch) it decided to bomb out on me and say the database was corrupted and needed repairing!

Example screen shot below….

corrupted table



It’s a nice simple program but I think my HDD is on the fritz so ended up getting errors all over the place and eventually received a message that it was corrupted and needed repairing

Basically the following is the commands I used to repair the database
{you must use a semicolon after each command}

– First open a command prompt (start > run > cmd) (run as admin on windows 7)
– Then change to your mysql\bin directory (i.e c:\cats\dogs\mysql\bin)
– Then enter the following command: mysql -u(yourDBUN) -p(yourdbpassword (default is root for UN)
– When logged in enter the name of your database with a semicolon following it
– If you are not sure type the command “show databases;” and press enter
– Then when you find the database type “use DBNAME;”

– Enter the below command (if you don’t know the table name {use show tables; if not sure})

show tables
– Your database should then be selected, after this enter the command “check table TABLENAME;”
– A message will probably be outputted its corrupted. Then just enter “repair table TABLENAME;” and after this everything should be repaired

table repair