SSH WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

My cloud server moved to VPC from classic network just now, and connecting to it via SSH got following error

 

Solution

It seems the server host key is changed, one way to solve this prolem is to remove the line containing server IP address from /root/.ssh/known_hosts . Then connect to it by SSH again, it will ask you whether trust this new host key, like following message

Type yes and press Enter key, this new host key is added to .ssh/known_hosts  then.

 

Also you can obtain the host key from the remote server, and add it to .ssh/known_hosts  manually , but we won't cover this method in detail.

MySQL Auto Backup

First create a shell script which is used to backup database, here we named the script as mysql_backup.sh:

In above command, we use date command to generate current date, and use it as part of filename.

After that we need to make this file executable

 

To make this backup script run automatically, we should create a cronjob. Type following command to open cronjob editor

crontab -e

Write following text and save it

Above command means the cronjob will run at 0:00 everyday