Jump to content
Stef's Coding Community
Sign in to follow this  
virtual

Help - I deleted my wp-config file

Recommended Posts

To cut a long story short, having made a custom WP theme I managed to upload it to Godaddy but thought I had to change my wp-config file. So I wrote over it (blazing fool that I am). Now I find out that almost everything I have done locally has been wiped out in the online Godaddy WP installation and I need to upload my whole database, or redo everything from the Dashboard online (waste of time).

 

However as I have wiped out the wp-config I can no longer see my local site as it gives me a database error. I can see the database from Mamp with PHPmyAdmin, but I have no idea how to reconnect it to the wp-config file

 

This is what I think I had there

 

/** The name of the database for WordPress */

define('DB_NAME', 'emasai_wp');

 

/** MySQL database username */

define('DB_USER', 'root');

 

/** MySQL database password */

define('DB_PASSWORD', 'root');

 

/** MySQL hostname */

define('DB_HOST', 'localhost');

 

/** Database Charset to use in creating database tables. */

define('DB_CHARSET', 'utf8');

 

/** The Database Collate type. Don't change this if in doubt. */

define('DB_COLLATE', '');

/**

* WordPress Database Table prefix.

 

$table_prefix = 'em_'; (I did change this to em_)

 

I'm not sure about the COLLATE section, if I put anything in there, and I have attached an image of PhpMyAdmin. Does anyone know how I can reconnect this again?????

Picture 1.png

Or can I just somehow copy my whole database and upload it to the new empty database?

Edited by virtual

Share this post


Link to post
Share on other sites

To reset up your wp-config file on your local machine, I would download a fresh install of WP, and use the included wp-config sample file, updating the database details with your own.

 

Now I find out that almost everything I have done locally has been wiped out in the online Godaddy WP installation and I need to upload my whole database, or redo everything from the Dashboard online (waste of time).

That's pretty standard. There's no "wiping out" involved -- you just start a blank database when you first install wordpress. If you are working on a local database, you will need to transfer that database from your local machine to the new web host's server. I usually use PHPMyAdmin's export function (see the "export" tab in your above screenshot) to create a .txt based dump of the database, and then import it to the web host using PHPMyAdmin on my web host.

Share this post


Link to post
Share on other sites

Thanks Ben, I got that to work. Now the database has 2 sets of tables, the ones I entered as em_ and the wp_. Can I safely delete the wp_ ones once I have updated the online wp-conf to show $table_prefix = 'em_'; ?

 

Is there somewhere I can read how to properly do all the steps involved in uploading WP, databases etc.

Edited by virtual

Share this post


Link to post
Share on other sites
Now the database has 2 sets of tables, the ones I entered as em_ and the wp_. Can I safely delete the wp_ ones once I have updated the online wp-conf to show $table_prefix = 'em_'; ?

Yes. You may need to edit a couple rows in the wp_options table. See my instructions below

 

Is there somewhere I can read how to properly do all the steps involved in uploading WP, databases etc.

I don't know of any links off the top of my head, but I imagine a Google search would bring some up.

 

Here are the steps I usually follow though, assuming I want to transfer a Wordpress site from my local development server to a new web server:

-- set up a new, clean install of Wordpress on the new server

-- when setting up the new database, make sure to use the same database prefix as your dev database

-- copy over the theme files (except for wp-config.php) and any plugins. Setup those plugins if necessary

-- update permalink settings if necessary

-- Using PHPMyAdmin or a similar database tool: drop all tables from the new database except the "wp_options" table. Export all tables from your dev database except for "wp_options", and import them into the new database

-- alternately, you could drop all tables from the new database, and import all tables from the dev database. You will need to update the "siteurl" row in the "wp_options" table (and any other settings that have changed.)

Share this post


Link to post
Share on other sites

Hi Ben

Sorry to be a pain, I managed to hook up my local development site again and then I did a new fresh install of WP on line, but

when setting up the new database, make sure to use the same database prefix as your dev database

In the set up it does not give me that option.

 

update permalink settings if necessary

Where do I do that?

 

Stick around, there'll be more questions as I come across problems.... :clap:

Share this post


Link to post
Share on other sites
In the set up it does not give me that option.

It should. It should be on the same page where you enter your database details. See image attachment.

 

Where do I do that?

It's within the WP admin under Settings > Permalinks.

Firefox1.png

Share this post


Link to post
Share on other sites

I don't get the wordpress set up window at all, I put all the info into Godaddy's interface, name of DB, username etc, Admin name and password and they don't give the option of the Table Prefix. So when it is set up, everything is already there, except for all my content of course.

This is where I went wrong because I was following a tut which told me to put all the info in the config file and then upload the whole WP installation from my computer.

 

So now to export my DB from PHPadmin, which format do I choose?

Share this post


Link to post
Share on other sites

Whoopee, silly fool me, I forgot to change the Table Prefix in the wp-config file. Now it's working, I still have to change the links. Thanks Ben, it just seems extremely complicated to do all this, I just thought it would happen magically like the rest of Wordpress does.... B)

Share this post


Link to post
Share on other sites

It does? It works fine for me.

 

I do notice that your main navigation items still use the localhost address. That means you have either hardcoded those items to use that address, or you may need to check the options under WP Admin > Settings > General. Make sure that both the "Wordpress URL" and the "Site URL" use the same address, or hold the correct values.

 

Wordpress is a bit confusing when you are getting started. It gets easier over time.

Share this post


Link to post
Share on other sites

Right, got another problem, how do I change the Permalinks, I went to Tools, settings but there is no where to change them to reflect te new name except in the .htaccess file which I cannot find. :blink:

Share this post


Link to post
Share on other sites

Changing the permalinks isn't something that you HAVE to do, and doesn't have anything to do with the new site url. I just added that to the list since if you had changed those settings on your dev site, you'd need to redo those changes on the live site as well.

Share this post


Link to post
Share on other sites

I found out I had to change the General Settings, because the site I uploaded was still pointing to my localhost. Now it's working and I'v almost got everything the way it's supposed to be. However, I find that if I had uploaded the whole thing from my local computer rather than have Godaddy install Wordpress for me, then it would have made the operation a lot simpler, because I had to go back in and change lots of things from my development site which I could just have easily have changed locally before uploading.

 

I guess each hosting service is different too.... :blink:

Share this post


Link to post
Share on other sites

I never did like Godaddy's installing of scripts such as Wordpress. And you are right, hosts do have different methods of installing script but most are generally the same. Godaddy seems to be one of the few that are different as to how it handles such script installs.

 

My tip: Always install the scripts (Wordpress, Joomla, etc.) manually using the scripts' installer.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...