ubuntu 服务器常用命令

ubuntu 服务器常用命令

登陆 ssh 通过 pem


ssh-add -k key.pem
#有可能会报以下错误
Permissions 0664 for 'key.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
#钥匙文件权限大了,改成只允许本用户可读可写就新

chmod 0600 key.pem
ssh-add -k key.pem


#成功:Identity added: key.pem


ssh 连接的服务器地址有过连接产生过认证凭据,服务器重装了就会认证失败,需要重置认证

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! 

ssh-keygen -r [服务器地址]
ssh [服务器地址] 

文件传输 scp

scp /var/www/html/drupal/door.php admin@192.168.43.52:/home/admin

scp [参数] 传输方 接受方

源地址:用户名@IP地址

格式 : <源地址>:<文件路径> 自己本机就可以省略源地址

参数:[-r] 传输整个文件夹

tar解压

-c 压缩

-x 解压

-z tar.gz格式

-v 显示

-f 紧接文件

tar -zxvf typecho.tar.gz -C [路径]

mysql 8

更改密码设置强度

show variables like 'validate_password%';

set global validate_password.policy=LOW;

创建数据库

create databases [] character set utf8;

创建用户

create user 'wordpressuser'@'%' identified by 'christina';

grant all privileges on wordpress.* to wordpressuser;

改host

update user set host='%' where user='root';	

导入数据库

mysql>create databases college;


mysql -u root -p [] college < college.sql

ufw

ufw allow 3306

apache2

sudo /etc/init.d/apache2 restart
posted @ 2022-09-23 17:45  Mangrove  阅读(21)  评论(0)    收藏  举报