NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order tolog into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] n ... skipping. By default, a MariaDB installation has an anonymous user, allowing anyone tolog into MariaDB without having to have a user account created for them. This is intended only for testing, andto make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n ... skipping. By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks forusing MariaDB!
重启服务systemctl restart mariadb观察是否正常。
若不正常继续键入netstat -tap | grep mysql确认 MySQL 是否在 listen 状态
use mysql; select user,Host from user; update user set Host='%'where user='root'; grant all privileges on *.* to 'root'@'%' identified by '密码' with grant option; flush privileges; exit;
重启服务,观察是否正常。
若还是不正常,继续键入cd /etc/mysql/mysql.conf.d查看配置文件是不是正常对外 IP 访问vim 50-server.cnf
#!编辑注释所有,添加以下 deb http://mirrors.aliyun.com/debian/ bullseye main contrib deb-src http://mirrors.aliyun.com/debian/ bullseye main contrib deb http://mirrors.aliyun.com/debian/ bullseye-updates main contrib deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main contrib deb http://mirrors.aliyun.com/debian/ bullseye-backports main contrib deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main contrib deb http://mirrors.aliyun.com/debian/ bullseye-proposed-updates main contrib deb-src http://mirrors.aliyun.com/debian/ bullseye-proposed-updates main contrib
from enum import Enum, auto as auto_rename import requests
DEEPL_API = "https://deepl.vercel.app/translate"
classTranslateError(Exception): pass
classParamInvalidError(TranslateError): pass
classAutoName(Enum): def_generate_next_value_(name, start, count, last_values): return name
classLang(AutoName): auto = auto_rename() DE = auto_rename() EN = auto_rename() ES = auto_rename() FR = auto_rename() IT = auto_rename() JA = auto_rename() NL = auto_rename() PL = auto_rename() PT = auto_rename() RU = auto_rename() ZH = auto_rename() BG = auto_rename() CS = auto_rename() DA = auto_rename() EL = auto_rename() ET = auto_rename() FI = auto_rename() HU = auto_rename() LT = auto_rename() LV = auto_rename() RO = auto_rename() SK = auto_rename() SL = auto_rename() SV = auto_rename()
defprepare_for_serialization(obj: dict): serialized_dict = dict() for k, v in obj.items(): serialized_dict[k] = v.name ifisinstance(v, Enum) else v return serialized_dict
deftranslate(text: str, target_lang: Lang, source_lang: Lang): if target_lang is Lang.auto: raise ParamInvalidError resp = requests.post( DEEPL_API, json=prepare_for_serialization({ "text": text, "target_lang": target_lang, "source_lang": source_lang }) ) if resp.status_code != 200: raise TranslateError result = resp.json() return result
if __name__ == '__main__': print(translate( text="Hello World!", source_lang=Lang.auto, target_lang=Lang.ZH ))
remote host key has changed port forwarding is disabled
点击下方终端机查看详情
1 2 3 4 5 6 7 8 9 10 11 12 13 14
$ ssh ec2-user@ec2-192-168-1-1.compute-1.amazonaws.com @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the ECDSA key sent by the remote host is SHA256:hotsxb/qVi1/ycUU2wXF6mfGH++Yk7WYZv0r+tIhg4I. Please contact your system administrator. Add correct host key in /Users/scott/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /Users/scott/.ssh/known_hosts:47 ECDSA host key for ec2-192-168-1-1.compute-1.amazonaws.com has changed and you have requested strict checking. Host key verification failed.
即可发现问题出现在.ssh/known_hosts,这便是 macOS 的存根路径,打开访达,前往文件夹,编辑删除对应 IP 即可。