目录
1.脚本与程序的区别
脚本:不需要编译:Javascript、Python、Ruby……
程序:需要编译的:C、C++、Swift、Kotlin、Go……
解释型:边解释边执行
编译型:计算机可以直接执行
2.安装软件的方式
主要派系 | Linux发行版 | 主要安装方式 |
Redhat红帽派 系 | Redhat、CentOS、Fedora 等 | make、rpm、yum、 dnf |
Debian派系 | Kali、Ubuntu等 | deb、apt、dpkg |
FreeBSD系 | FreeBSD | make、pkg、ports |
1.源码安装
下载源代码安装文件
tar包解压缩
./configure配置
make编译
make install
配置并使用软件
2.rpm安装
操作 | 命令 | 说明 |
查询 | rpm -qa rpm -q 包名 | q:query |
安装 | rpm -ivh 包名 | i:install v:verbose h:hash |
升级 | rpm -Uvh 包名 | U:安装或升级最新版 |
卸载 | rpm -e 包名 | 需要先卸载依赖其的软件 |
3.yum安装
基于rpm,解决安装依赖包的问题
操作 | 命令 |
列表 | yum list yum list 包名 |
搜索 | yum search 包名 |
安装 | yum install 包名 |
升级 | yum update 包名 |
卸载 | yum remove 包名 |
更新所有软件 | yum update |
清除缓存 | yum clean all |
更新yum缓存 | yum make cach |
4.DNF与YUM的区别
5.Debian系
Deb包安装
apt安装
操作 | 命令 |
搜索 | apt search 包名 |
安装 | apt install 包名 |
升级 | apt update 包名 |
卸载 | apt remove 包名 |
6.FreeBSD系
操作 | 命令 |
搜索 | pkg search 包名 |
安装 | pkg install 包名 |
升级 | pkg upgrade 包名 |
卸载 | pkg del 包名 |
3.在CentOS安装MySQL
1.下载yum repository
wget http://dev.mysql.com/get/mysql80-community-release-el7-8.noarch.rpm
2.安装mysql源
yum localinstall -y mysql80-community-release-el7-8.noarch.rpm
3.安装mysql
yum install -y mysql-community-server
如果出现
Failing package is: mysql-community-client-8.0.36-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022, file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
解决方法
# yum -y install mysql-community-server --nogpgcheck
4.启动mysql
systemctl start mysqld
5查看是否启动成功
查看端口是否启动
nestat -an | grep 3306
查看mysql进程
ps -ef | grep mysql
查看服务
systemctl status mysqld.service
6.修改密码
查找root用户初始密码
grep "password" /var/log/mysqld.log
密码为4aFiaodkfP_:
mysql -uroot -p (有密码登录)
临时修改
set global validate_password_policy=0;
set global validate_password_length=1;
永久修改
打开文件
vim /etc/my.cnf
添加
validate_password_policy=0
validate_password_length=1
执行一下命令
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root1234';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root1234;';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'rootA1234;';
Query OK, 0 rows affected (0.00 sec)
修改后重启mysql
service mysqld restart
7远程连接
mysql> create user 'root'@'%' identified with mysql_native_password by 'root';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on *.* to 'root'@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)