First of all, thank you @dennis for the free one year coupon to test out CodeGuard!
Now, I tried to setup my MainWP Dashboard with CodeGuard, I was able to connect to the SFTP but, for the database, it requests access to the hostname of the DB. Mine is not accessible publicly, I can only access it via the Cpanel. I checked the SSH solution but super complicated… Did I miss something?
Because with UpdraftPlus, we can just setup the backup schedule, what type (full or DB) and all good to go. You can also specify an external source to save it.
So, is there any simpler way to setup the DB backup?
I assume you already attempted whitelisting CodeGuards IP’s.
CodeGuard is active above your WordPress site, unlike UPDraft, which is a plugin that relies on WordPress to work. So in your situation where the Database is not accessible, you will need to use SSH to access your Database.
Have you also looked over this article?
Which part of the steps, exactly are you having trouble with, and someone with more server experience like Keith @kwcjr can probably help.
Please, give me a a bit - I am attempting to make you a video on how to connect your DB.
It would be helpful if we knew what Hosting company this “inaccessable” DB is on. Technically your DB MUST HAVE an I.P. that is accessible to the public or it would never be able to be used by wordpress in the first place. It’s most likely a port or a separate IP all together like Siteground does for connecting to DB over SSH.
Also, if you are using CG’s Public Key, they are different for each connection; You will have two per site that you connect to. One for the SFTP and one for the SSHTunnel. My suggestion to get around needing two for each connection is to make a MASTER key pair yourself and upload THAT to CG. I have not tested this yet so please give me time.
Or to simplify the entire process you can use the WP Plugin that CG provides and you will be connected through that via SHH Key Pairs as well. It’s just Automated. I have tested this and it works fine.
Thank you for your Patience I will have a rough video for you here soon.
I have been on support myself with my Hosting Company Sitegrounds since I took on this ticket. I don’t think I will be able to make a video on how to use SSH Tunnel to connect at this time. I have gone over my entire setup with Siteground and they have confirmed that all settings within CG are correct but I am getting an error “Lost connection. The connection to your MySQL server was lost or killed.”
So far I know how to correctly generate Private/Public Keypairs, Upload them and get CG to connect via SFTP This would be the best solution to lessen the amount of KeyPairs you would need to generate in order to connect to your Child Sites SFTP at least.
I’m sorry I don’t have a better answer for you at this moment. SSH is not a novice task & sometimes you have to work with your Hosting company if things don’t work right away.
In the mean time,
You can simply use MySQL Direct to connect to the Database. You would only need your wp-config.php credentials to connect. That’s what I am currently doing myself.
So you have the same information I do - These are the steps I took to connect via SSH Tunnel
Private Key (Note: CodeGuard only supports unencrypted RSA and DSA keys so do NOT use a passphrase when asked )
1.) Create a Public/Private Keypair via ssh-keygen ( So you are not forced by your host to Encrypt it with a passphrase; most do )
Within Windows PowerShell OR Linux Terminal type the command:
$ ssh-keygen -t rsa
Open those two files in a Text Editor of your choice
id_rsa is your Private Key that you use on CG
id_rsa.pub is your Public Key that you put on your server
2.) Install the public key as an authorized key on your server
Log into cPanel
search for SSH
upload your Public Key
3.) Upload your Private key to CodeGuard
Username is your cPanel Name
Password is your cPanel Password
[Siteground Caviat] - SSH port is 18765
Database Hostname: Usually your server IP
Enter in Database Name
Enter in Database Password
MySQL Port keep 3306
ssh username cPanel
ssh password cPanel
click add private key & paste your private key in again
[Siteground Caviat] - SSH port is 18765
[Siteground Caviat] - Database Hostname Not Server IP ( see "Remote MySQL" cPanel Tool )
I was unable to Grant Rights so I am waiting to hear back from SG Technical Team to see if they can add it. The directions above should work if your Host Allows it & you have uploaded your keys correctly & are using the correct login details. However, every server is different.
@wpexpert You’re welcome. It’s not always a straight forward task and is almost always different on each Server/Host. It sometimes takes trial and error & working with your hosting company till you get the right combination.