liunx安装服务爬坑文档

liunx学习爬坑文档,所有内容均来自整理

查看服务列表
    chkconfig --list
重启服务
    service mysqld restart
ls 查看列表
cd 打开
cd / 打开根目录
vim 文本编辑器查看
    esc后 : 输入
        q 退出
        q! 强制退出
        wq保存退出
        wq!强制保存退出
    
查看服务是否启动成功
    ps -ef|grep mysqld

以下来源 yum安装mysql
yum 安装mysql
    检查有无mysql
        yum list installed mysql*
        rpm –qa|grep mysql*
    检查安装包
        yum list mysql*
    安装客户端
        yum install mysql
    安装服务器
        yum install mysql-server
        yum install mysql-devel
    
    启动或关闭服务
        service mysqld start
        service mysqld stop 
    
    设置开机启动
        chkconfig --add mysqld 
    服务启动后,查看端口
        lsof -i:3306
    创建管理员密码
        mysqladmin -u root password 密码
    进入 mysql -u root -p 
    设置mysql允许访问 如下

liunx通过防火墙 非centos7安装
    vim /etc/sysconfig/iptables
    加入 -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT 并保存
    systemctl restart iptables.service      -- 重启防火墙
    systemctl status iptables.service       -- 查看状态
    service iptables save                   -- 保存规则
    systemctl enable iptables.service       -- 设置开机启动
    systemctl start iptables.service        -- 开启服务

以下来源 centos7关闭防火墙
liunx关闭防火墙
    centos7
        查看防火墙 systemctl status firewalld.service
        关闭防火墙 systemctl stop firewalld.service
        永久性关闭 systemctl disable firewalld.service
        启动防火墙 systemctl start firewalld.service
        防火墙随系统启动 systemctl enable firewalld.service
        
以下来源 mysql权限修改        
mysql 修改允许访问的权限内容
    mysql -u root -p
    mysql>use mysql;
    mysql>select 'host' from user where user='root';
    // % 允许所有ip进行访问
    mysql>update user set host = '%' where user ='root';
    // 刷新权限之后,才会加载生效
    mysql>flush privileges;
    mysql>select 'host'   from user where user='root';

猜你喜欢

转载自blog.csdn.net/u011008832/article/details/114284918