Forum

Thread tagged as: Problem, Installation, Configuration

Moving a dev site to staging. Workflow / Settings problem

I am trying to sort out my workflow and am in the process of moving my dev code to a staging server. However, I am having problems connecting with my staging database. I think it may be a database / table naming issue.

I have ran the compatibility test on the staging server, it works okay. I am using the same connection details from the test in my config file. I have imported the database dump.sql file from my dev machine to the staging server, although the database is named differently.

I followed the instructions on the Perch site about moving a site, however I have obviously messed up somewhere? Any advice about how to progress welcome. (Diagnostics from the Perch login screen below.)

My dev database locally is named projectdb

My production database uses the same connection details username, password and database name.

My staging database however has a different name projectdbstaging


DIAGNOSTICS: SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0 Invalid query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'projectdbstaging.perch2_settings' doesn't exist SELECT * FROM perch2_user_privileges WHERE privKey='perch_backup' LIMIT 1 Invalid query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'projectdbstaging.perch2_user_privileges' doesn't exist INSERT INTO perch2_user_privileges(privKey,privTitle,privOrder) VALUES('perch_backup','Run backups',1) Invalid query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'projectdbstaging.perch2_user_privileges' doesn't exist Queries: 0
Andy Clark

Andy Clark 0 points

  • 7 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

It looks like your database hasn't fully imported. Make sure that your local and live databases have the same tables in them.

Okay, thanks Rachel, I´ll check that. Yes - my dev database has 35 tables = 3.5MB, and staging has 14 tables = 922KB.

Further investigation required. Using MySQL Workbench for the first time.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

I would just do a mysqldump at the commandline of the complete database locally, and import it at the commandline on the server.

Okay, I´ll try that. ( Once I work out how to do it.)

Using Workbench I can only seem to transfer over half of the tables? Not sure if the problem is with Workbench or my php settings on the server.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

I have no idea about Workbench, I tend to just work at the commandline. It's unlikely to be anything to do with PHP however.

I visited the command line. Still no good. Eventually looked at the actual dump.sql file and the first line reads


CREATE DATABASE IF NOT EXISTS `projectdb` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `projectdb`;

Changed projectdb to projectdbstaging and tried again. Success! The dump file then wrote to the correct database as opposed to creating the production database ´projectdb´ over and over again.

Well I know more now than I knew this morning, including:

  • Perch support is great, thanks Rachel.

  • MySQL Workbench is great.

  • The command line is only a little bit scary.

  • Creating a side project progresses one baby step at a time.