• Resolved soundblob

    (@soundblob)


    Hey.
    I stupidly changed my locally hosted wp urls to sndblb.com (where I intended to upload them to) and lost access to my wordpress admin and can’t view my site locally.
    I did this because I have just finished building my site and was ready to upload it to an online server space.
    I don’t want to use it locally anymore. So my question is.. is it possible to extract the database and use it in my online server space?
    Like I said, because I changed the name I can no longer access it locally and it’s not showing up in PHPmyadmin.
    I don’t care if I can’t edit it locally I just need to get the database for my online site.

    Please speak slowly, I’m really new to this stuff. Thanks in advance
    Cheers,
    Rob

Viewing 10 replies - 1 through 10 (of 10 total)
  • ok, so if I’ve understood you correctly you have changed the URL’s in the database.

    Is this the two held in wp_options? or do you think you’ve changed something else?

    I presume you can still access files and folders locally?

    If you did change in the database, you could try running a php programme to change them back, if this is your issue, the code below might help you

    User, password, and database can be found in wp-config, if you don’t know how to look this up, come back. Not having played with local wordpress, I presume the xxxxx would be ‘localhost’, but hopefully you know what it was before the change

    <?php
    $user="aaa;
    $password="bbb";
    $database="ccc";
    $host="localhost";
    $con=mysqli_connect($host,$user,$password,$database);
     //Check connection
     if (mysqli_connect_errno())
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
     }
     $update= "UPDATE wp_options SET option_value = 'xxxxxxxxx' WHERE option_name IN ('siteurl', 'home')" ;
    	mysqli_query($con,$update)  ;
    ?>

    So if you use notepad to create a file called change.php and dump the code in it. Then copy/ftp this file to your local wp instance in a folder you know the path to. Then type the path and filename into a browser, and it’ll run.

    Thread Starter soundblob

    (@soundblob)

    Thanks so much for getting back to me Robin.
    I follow everything except the last step.
    I’ve written the file as you said.
    How do i “copy/ftp this file to your local wp instance in a folder you know the path to.”

    Not having played with local wordpress, I’ll need to guess.

    With a hosted version I’d FTP it to a known wordpress directory in the root using an FTP package (such as filezilla) -in my case this is /mysite.com/web, which is also where wp-config.php is held. Then in my browser I’d put “www.mysite.com/change.php” and it would run the programme.

    For you, I’d do a search for wp-config.php on my PC, and copy/paste the change.php file to that location eg c:\files\wordpress\ or wherever the search says that file is.

    Then you should be able to run it by typing that path and file into the browser eg c:\files\wordpress\change.php
    or you should be able to use whatever pathname you use for wp-admin
    (again don’t specifically know as I’ve not done local) but if you type “localhost/wp-admin” to logon then “localhost/change.php” should work.

    Thread Starter soundblob

    (@soundblob)

    So. When it was working locally. I accessed my site at localhost:8888
    I made the file and tried to run it with localhost:8888/change.php

    and i get:
    “HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.”

    if i try localhost:8888 i get:
    “can’t establish a connection to the server at localhost”

    If I try localhost:8888/wp-admin it redirects me to the url that I changed the wp urls to sndblb.com and I get this message:

    “There doesn’t seem to be a wp-config.php file. I need this before we can get started.
    Need more help? We got it.
    You can create a wp-config.php file through a web interface, but this doesn’t work for all server setups. The safest way is to manually create the file.”

    Redirected to : http://sndblb.com/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%3A8888%2Fwp-admin%2F&reauth=1

    If you can think of anything else… Cheers Robin.

    Did you try the C:\.. route?

    That should in theory work.

    or try

    http://localhost/wordpress/change.php

    Did you find where your config file was stored?

    Have you already got xxamp installed?

    Much easier to add some lines to wp-config.php to reset the URLs. See Changing The Site URL « WordPress Codex for recovery instructions.

    And/or use WordPress Serialized PHP Search Replace Tool

    Thread Starter soundblob

    (@soundblob)

    Thank you both for your advice.
    This worked from http://codex.wordpress.org/Changing_The_Site_URL

    “Edit wp-config.php
    It is possible to set the site URL manually in the wp-config.php file.

    Add these two lines to your wp-config.php, where “example.com” is the correct location of your site.

    define(‘WP_HOME’,’http://example.com&#8217;);
    define(‘WP_SITEURL’,’http://example.com&#8217;);

    This is not necessarily the best fix, it’s just hardcoding the values into the site itself. You won’t be able to edit them on the General settings page anymore when using this method.”

    I put in http://localhost:8888 for the examples.

    Here is the final result: http://www.sndblb.com

    Thanks again!

    Hey great that you got this fixed !!

    Thread Starter soundblob

    (@soundblob)

    A final note. If you are doing this. The above solution is perfect as it reactivates the site and gives you the chance to export the database, which you can then upload to your online host.
    if you have any questions please ask me. I’d be delighted if all the stress I had trying to figure it out, could benefit someone else.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Can't find database on localhost (after locking myself out by changing URL)’ is closed to new replies.