LINUX常用应用安装
软件名称 | 解释 | 命令 |
apache | 安装 | 重新启动 |
启动 |
service httpd start(开启服务后需要把防火墙关闭: service firewalld stop ,查看是否启动服务:ps -ef| grep httpd) |
|
停止 | service httpd stop | |
重新启动 |
service httpd restart(把线程杀死,重新开启服务,用户可能会出现短暂访问不了的情况) service httpd reload(用户感受不到影响) |
软件名称 | 解释 | 命令 |
mysql
|
移除默认安装的 mariadb-libs | yum remove mariadb-libs.x86_64 |
下载mysql源: |
https://dev.mysql.com/downloads/repo/yum/ cd /tmp wget https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm |
|
安装源 |
yum localinstall mysql57-community-release-el7-8.noarch.rpm | |
安装服务端 | yum install mysql-community-server | |
启动 | service mysqld start/restart/reload | |
停止 | service mysqld stop | |
默认密码 | cat /var/log/mysqld.log | grep "password" | |
8.0版本以后使用 修改密码 |
set global validate_password.policy=0; set global validate_password.length=1; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; |
|
开启远程连接: Host改为%符号 |
1. update user set Host = '% where User= 'root' and Host = ''localhost' 2. flush privileges; 3. 关闭防火墙 4. 开始连接 |
|
设置generlog |
set global general_log_file='/tmp/general.log'; set global general_log=on; |
|
新建用户 |
create user 'test'@'%' identified by '123456'; |
|
赋予权限 |
grant all privileges on *.* to 'lifei'@'%' ; |
|
忘记数据库密码后怎么修改 |
vim /etc/my.cnf 最后面加入 skip-grant-tables update user set authentication_string='' where user='root'; 退出mysql, 删除/etc/my.cnf文件最后的 skip-grant-tables 重庆mysql服务 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; |
软件名称 | 解释 | 命令 |
memcached | 安装 | yum install mencached |
启动 | memcached -d(后台运行) -l(监听ip地址) -m(分配内存) -p(监听端口号) | |
停止 | kill pid | |
查看监听的端口 |
sudo netstat -anpl | grep mem |
|
查看端口是否畅通 | telnet 127.0.0.1 11211 | |
测试memcached |
set test 0 60 10 hellowrold STORED get test VALUE imooc 0 10 helloworld END delete test DELETED quit(退出) |
|
关闭memcached |
ps -ef | grep mem test 2820 1 0 12:49? 00:00:00 memcached -d kill 2820(进程编号) |
软件名称 | 解释 | 命令 |
redis | 安装 |
源码编译安装 去官网复制链接使用 wget http://download.redis.io/releases/redis-5.0.3.tar.gz tar -xzvf redis-5.0.3.tar.gz 安装 gcc yum install gcc make sudo make install |
位于 src下: redis-server |
redis 服务端启动程序 |
|
redis-cli |
redis客户端操作工具 , 127.0.0.1:6379> LPUSH imooc_list redis
也可以用telnet 过呢根据其纯文本协议来操作: telnet 192.168.101.147 6379 set test hello +OK get imooc "hello" Redis 基本命令网址学习:https://www.runoob.com/redis/redis-commands.html |
|
redis-benchmark |
redis性能测试工具 |
|
redis-check-aof |
数据修复工具 |
|
redis-check-dump |
检查导出工具 |
|
启动 | redis-server start/restart | |
停止 | redis-server stop | |
客户端 | redis-client |
redis 特性:
Redis不仅仅支持简单的K/V类型的数据,同事还提供list , set ,hash 等数据结构的存储
Redis支持数据的备份 , 即master-slave模式的数据备份
Redis支持数据的持久化 , 可以进昂欸村中的数据保存在磁盘中 , 重启的时候可以再次加载进行使用