This article has participated in the good article call order activity, click to see: back end, big front end double track submission, 20,000 yuan prize pool for you to challenge!

What process

The website can not visit the matter also has happened, I did not think much at that time, the feeling should be the service hung up, restart it.

Gie tapped the command skillfully with two fingers, and the service was successfully started. It was perfect. Visit the home page and have a try.

This…… There is no table in the database, so I opened the database with the local navicat and looked at it.

The two libraries are completely deleted, leaving only a table. The content of the table roughly means that your database has been attacked by me. If you want to redeem it, you should hand over the bitcoin as soon as possible, or you will spread it immediately.

Path to database recovery

Even if ten thousand that what what pentium over, flower Gie also want to be strong, do not cry. Don’t panic, often walk along the river where there is no wet shoes, this time more need to show amazing coping ability.

  • The backup library

I first looked at the previous backup, very sad, this is my personal website, usually on their own development and maintenance, in the test environment only table structure, no data backup, can not help but shed tears without backup habit.

  • binlog

No panic, and binlog (at this time the heart has started to panic, silently pray that the binlog must have been turned on at that time).

To open the database, enter show variables like ‘log_bin’; To view

Well, good, it turns out, as I thought, I didn’t turn on binlog…

Prior to MySQL8, this feature was turned off by default and needed to be turned on manually. Although my database binlog is not enabled, I want to introduce binlog to other friends.

  1. in/etc/my.cnAdd the following configuration files(I'm going to write a tutorial on how to do binlog, right)

[mysqld]

server_id=1918

log_bin = mysql-bin

binlog_format = ROW

  1. Restart the mysql

CentOS 6: service mysqld restart

CentOS 7: systemctl restart mysqld

  1. useshow variables like '%log_bin%'Check whether the function is enabled successfully

  • Server snapshot

The first two don’t work, and to be honest, I’m a little freaked out, really freaked out… It’s a shame that I’ve lost 100,000 photos and more than 1,000 posts that I’ve worked so hard to accumulate on my blog. So I thought hard, think I can go to look for the snapshot of Tencent cloud server, this is my last straw, I carefully logged in the website, click the snapshot button, I even dare not open my eyes.

Hahahahahaha……. Hahahahahaha……… Ahhhhhhhhhhh………… Ahhhhhhhhhhh…………… Aha, ha, ha, ha, ha.

God pays off, finally after so long effort, I gave up, I stepped horse to give up, the server has no snapshot. I was crying. I was crying so loud.

Last stubbornness

Influenced by the excellent environment since childhood, Huagie will not bow to the evil forces, never, never. Look, this is the mailbox…

The lessons of the blood

Comprehensive my this event, HERE I also give friends some warning, but also some attention:

  • Password hardening, do not root/root, admin/admin, it is very easy to crack the head
  • The default port 3306 is not recommended
  • It is extremely not recommended to release remote access atmy.cnfAdd binds-address =127.0.0.1 to the configuration file to set local access only. For hard requirements, only specific security segments are allowed to access the database.
  • openbinlog
  • Use the security group function of cloud hosts to restrict access sources and ports.

conclusion

As for network security, this is also a wake-up call and an example for my friends. If there are any other ways, please leave a message and tell me. I still want to struggle and cry for comfort again.

Pay attention to avoid getting lost

That’s all for this episode. If you have any mistakes, please leave a comment. Thank you very much. I’m Flower Gie, feel free to leave a comment if you have any questions, and we’ll see you next time at 🦮.

The article continues to be updated, can be wechat search Java development zero to one first time to read, and can obtain interview materials learning videos, interested partners welcome attention, study together, ha 🐮🥃.

Original is not easy, how can you bear white whore. if you think this article is a little useful to you, thank you for the old iron for this article point a like, comment or forward, because this will be my power to output more quality articles, thank you!