调整窗口大小:设备—安装增强功能
安装ifconfig: sudo apt-get install net-tools
更新:sudo apt update
安装mysql:
删除mysql的数据文件sudo rm /var/lib/mysql/ -R
删除mysql的配置文件sudo rm /etc/mysql/ -R
卸载mysql(包括server和client)
sudo apt-get autoremove mysql* --purge
sudo apt-get remove apparmor
然后在终端中查看MySQL的依赖项:dpkg --list|grep mysql
1、安装:sudo apt install mysql-server mysql-client
2、查看:sudo systemctl status mysql
安全操作:sudo mysql_secure_installation
3、安装依赖:sudo apt install libmysqlclient-dev
4、登入:sudo mysql 或者 mysql -u root -p 或者进入/etc/mysql目录下,查看debian.cnf文件可以看到初始账号密码
Mysql -u Debian-sys-maint -p …
5、use mysql;
6、修改密码
update user set authentication_string=PASSWORD("root")where user='root';
上面可能不适用mysql8
Alter user ‘root’@’localhost’ identified with mysql_native_password by ‘root’;
设置plugin字段
update user set plugin="mysql_native_password";
7、设置远程访问:
Use mysql;
select host,user from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION
flush privileges;
quit
8、防火墙开放3306端口iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
9、修改MySQL监听sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
10、#注释掉bind-address = 127.0.0.1
11、重启动MySQL
sudo /etc/init.d/mysql restart 或者 sudo service mysql restart
其他命令:
创建用户:CREATE USER 'username'@'host' IDENTIFIED BY 'password';
查看用户:SELECT User,Host FROM mysql.user;
用户授权:grant all on *.* to 'dimp'@'%' identified by '12345678';
查看密码策略SHOW VARIABLES LIKE 'validate_password%'
设置密码强度为lowset global validate_password_policy=LOW;
//添加个新的root主机是%
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
报错:you are not allowed to create a user with grant
把localhost改为%
Update user set host=’%’ where user = ‘root’;
Grant all on *.* to ‘root’@’%’;这句要执行两次才成功。
user = debian-sys-maint
password = UGh1OLt6VmpcAUkx
update user set authentication_string='' where user='root';
create user 'root'@'%' identified by 'root';
grant all on *.* to 'root'@'%';
alter user 'root'@'%' identified with mysql_native_password by 'root';
flush privileges;
防火墙管理:
sudo ufw disable 防火墙在系统启动时自动禁用
sudo ufw status 状态:不活动
~ sudo ufw enable 在系统启动时启用和激活防火墙
sudo ufw allow 81 规则已添加
sudo ufw deny 81 规则已更新
安装ssh
Sudo apt-get install openssh-server
安装telnet
安装openbsd-inetd
sudo apt-get install openbsd-inetd -y
安装telnetd
sudo apt-get install telnetd -y
重启openbsd-inetd
sudo /etc/init.d/openbsd-inetd restart
查看telnet运行状态
sudo netstat -a | grep telnet
登录
telnet 127.0.0.1(本机)
安装wireshark
Sudo apt-get install wireshark
Sudo usermod -aG wireshark 你的用户名