I have deleted my site! What do I do??!
This can be one of the simplest problems to solve.
First, check to make sure you do not have a backup already. It’s possible you used All-In-One WP Migration and have a backup hidden away in Dropbox or locally on your computer.
If not, and you had local backups enabled within GridPane, you can follow the steps as outlined below. V1 backups differ to V2 backups, and currently V2 is more complex, though this will be fixed in the future.
V1 Backup Restore
- Create a new site with the same name and on the same server as the old site.
- Open the site configuration modal window and go to the Backups tab.
- In the Restore/Migrate/Clone section, choose Restore and select an available backup.
Voila! Your site is back in business!
V2 Backups (BETA) Restore
In the future, this will become much easier.
Step 1. Follow the same 3 steps as in backups V1:
- Create a new site with the same name and on the same server as the old site.
- Open the site configuration modal window and go to the Backups tab.
- In the Restore/Migrate/Clone section, choose Restore and select an available backup.
This restore will fail part way through, as right now it will not overwrite the existing database, or create a new one. It will, however, overwrite the wp-config.php and give you the details you need to recreate that database.
Step 2. Get your database details from your wp-config.php file
Open up your sites customizer and click on the link to open up your sites wp-config.php file.
Here’s an example of the details you will need:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'fMd_test2_com' );
/** MySQL database username */
define( 'DB_USER', 'fMd_test2_com' );
/** MySQL database password */
define( 'DB_PASSWORD', 'HWPkaEsYbQFtHhSahPXUgVOpS' );
Step 3. SSH into your server
Follow these guides to get started:
Generate your SSH Key:
Generate SSH Key on Windows with Putty
Generate SSH Key on Windows with Windows Subsystem for Linux
Generate SSH Key on Windows with Windows CMD/PowerShell
Add your SSH Key to GridPane:
Add/Remove an SSH Key to/from an Active GridPane Server
Connect to your server:
Step 4. Login to MySQL
Run the following command:
gp mysql login root
Step 5. Create your database
Run the following command, replacing “database_com” with your database name:
CREATE DATABASE database_com;
For example:
CREATE DATABASE fMd_test2_com;
Step 6. Create your database user
Run the following, switching out “database_com” with your database user, and “p@ssw0rd” with your database password:
CREATE USER 'database_com'@'localhost' IDENTIFIED BY 'p@ssw0rd';
For example:
CREATE USER 'fMd_test2_com'@'localhost' IDENTIFIED BY 'HWPkaEsYbQFtHhSahPXUgVOpS';
Step 7. Grant Permissions
Run the following, switching your database credentials again:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON database_com.* TO 'database_com'@'localhost';
For example:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON fMd_test2_com.* TO 'fMd_test2_com'@'localhost';
Also, alternatively, you could grant all privileges with this instead:
GRANT ALL PRIVILEGES ON database_com.* TO '$database_com'@'localhost';"
And finally, flush privileges with:
FLUSH PRIVILEGES;
Step 8. Re-run your Restore
Back inside your GridPane account, run your backup restore again to restore your website.
Step 9. Fix PHPMyAdmin
Now we just need to set the correct database inside PHPMyAdmin. To do so, run the following command in your server, switching out “example.com” for your websites name:
gp site example.com -dbcreds