WordPress Error establishing a database connection (xampp) - mysql

I am using xampp to host my website local. I am making a WordPress site with the MySQL database from xampp.
Now, I bought a new computer and took backup of my WordPress folder. Now when I try to open my WordPress site on my new computer, I get the error: Error establishing a database connection
I can image this is because the database that is linked to the WordPress site is not on my new system.
I formatted my old drive so I cannot restore the old database. Is there a work around?

If you have your old database file (.sql) then you can just
Run this link from your browser http://localhost/phpmyadmin.
Select Database which you want to upload the SQL file. (If no DB , create new database).
Click on Import option from top menu section and upload you files.
and for taking backup of your database on Xampp
1. Run this link from your browser http://localhost/phpmyadmin.
2. Select Database which you want to take backup of.
3. Click on Export option from top menu section and backup your files.

If your old drive is completely formatted, and you weren't using any sort of Wordpress backup plugin, then no, you won't be able to rebuild the site. Sorry! As well as storing your content (posts / articles), your Wordpress database also stores information on which plugins you were using, so it is an critical part of rebuilding any Wordpress site.
Next time around, you should export your database to a file (eg .sql), so you can import it on your new server/laptop. You would achieve this by either using a Wordpress plugin, or on XAMPP by using phpMyAdmin. You could also do this with 3rd party apps, like SequelPro or MySQLWorkbench.
You should have your images and static assets saved - eg css files, uploaded images, so you have something to start with, if you decide to rebuild your site without the database.

You need to install your wordpress site again with new database. You already lost it. Always backup your wordpress site.
You can backup your wordpress site with this plugin and it's free-
https://wordpress.org/plugins/updraftplus/
Thanks
BanyanTheme

Step 1: Backup your database on the old computer.
Step 2: Restore the database onto the new computer.
Step 3: Run file install in wordpress
Good luck!

Related

Restoring wordpress site using .zip and .sql onto AWS

What is the best was to restore a website from a backup when all I have is a .zip file and a .sql file of the wordpress site migrating onto aws. So far I tried installing wordpress with a EC2 instance of wordpress and I was going to try and restore from the dashboard using a wordpress plugin. But no plugin I found can upload a .sql database like I thought. Which doesn't make much sense now that I really think about it. I am unsure if should I install a Microsoft SQL Server DB Instance in RDS or MySyl for the wordpress install? Please help so confused...
You can use that method:
Extract the wp-content folder and upload it.
Log onto your ec2 and use the mysql command line to import the database.
Update the siteurl and home in wp_options.

I deleted database of my wp website and wordpress asks to be reinstalled

I deleted database and db user of my WP website. My website stopped working.
I opened wpadmin.php and created database and user according to info in it.
Now when I try to open my website it redirects to
http://iiuischoolsryk.com/wp-admin/install.php
What should I do now? Should I proceed to Installation?
PS:
Although hosting provider is my best friend, he is not available to help
I have access to Cpanel, phpMYADMIN.
I have complete installation files of that particular wp theme.
All your previous data, unless backed up, is totally gone. You'll have your theme and plugins still in their directories, but no pages, posts, etc.
To get back to having a blank wordpress installation, do the following.
Create a new MySQL database, via phpMyAdmin if you like.
Create a new MySQL user, with password, and assign them permissions
to the database created in step 1.
Now run the 5 minute WordPress install with the database name, user
name, and passwordyou've just created.

Restoring site using .sql backup import

I'm unable to restore my site database and need help figuring out why. The Wordpress site is on my local computer.
Here's what I did:
• Exported the backup file in a zip format
• Made updates to plugins through Wordpress platform
• Site crashed from bad update; tried to delete that plugin and made things worse
• Decided to restore backup; tried importing through phpmyadmin; came back with errors
• Dropped all the tables from that database
• Unzipped by backup file; commented out "create database" line
• Tried importing again and came up with the following errors:
#1007 - Can't create database 'Wordpress'; database exists
I've built several websites locally in the past so yes, there's already another database called Wordpress. I'm not sure how to delete them besides dropping the tables.
I'm losing hope that I'll ever be able to restore this site.
Any insight?
To import your database,
open it with your text editor like NotePad++
locate (should be at the beginning of the file) and erase the line:
"CREATE DATABASE yourdbname"
Save it
Now try to import it again
Also, it seems like you have only one database called Wordpress and you're using it for all your websites, right? You should make a unique name, for each database/site you create. You can still do that for your current site and create a new database, import your tables, and edit your wp-config.php file to communicate with the new database.

Ezpublish create new Mysql database after the old Mysql database got deleted

Recently I setup a website on byethost.com using the CMS ezpublish. After a couple days of working on the site, byethost deleted the Mysql database. I still have all the FTP files but I can't log in as an admin because their is not Mysql database with all the users. Is there any way I can create a new Mysql database setup for Ezpublish. All I need currently is an admin account and whatever other information is essential to have for Ezpublish to run. Any response/ideas would be great.
Just create a new database
Then, for a plain site (not ezflow neither ezwebin) import those files : kernel/sql/mysql/kernel_schema.sql and kernel/sql/common/cleandata.sql in MySQL.
The admin username will be : admin and the admin password will be : publish
By the way, an other solution is to edit settings/override/site.ini.append.php and change this:
[SiteAccessSettings]
CheckValidity=false
to this:
[SiteAccessSettings]
CheckValidity=true
Reloading a page will lead to launch the setup wizard just like if it was a fresh install. (If it doesn't work, you may need to clear the cache by yourself and try again)

Configuring development, staging and production versions of a WordPress site

I have an already-in-production Wordpress-powered site. I would like to create both a MAMP-powered development copy of this site on my local machine as well as a staging copy that lives on my web host. When the time comes, I would push the content from local dev to staging, and staging to production after testing.
In terms of properly adding all the content to all three sites, I did see this article in the Codex but I think I can get away with simpler method if I:
Download the production site content as an XML file using "Tools > Export" under the WP Dashboard.
Import the XML file into phpMyAdmin on my local MAMP site.
Make sure all the plugin configs match.
Create another XML file using "Tools > Export" on the MAMP side, then import it into the new staging site.
Change the DB name, UN, and PW info in the staging site's wp-config file.
To move the XML file from staging to production, I would repeat steps 4. The wp-config file is already up and running so there's no need to change anything here.
Also, since I changed the database's 'wp_' table prefix on production, I'm assuming that I need to do the same for both the development and staging environments.
I'm not good with MySQL and have only used phpMyAdmin a little which is the reason I'm asking this question. Did I miss something major and am I about to spectacularly crash-and-burn my site if I do all of this?
I think just make sure the database specified in wp-config.php matches the version.
ie.
development wp-config.php specifies wp_devdb
staging wp-config.php specifies wp_stagedb
production wp-config.php specified wp_productiondb
creating the databases (using mamp locally)
mysql -u root -p
(then enter your password)
mysql->create database wp_devdb
->create database wp_devdb
Do not drop any table if it is important, ie your production table should not be dropped unless you want a fresh install