ubuntu 安装mysql和redis 开放远程连接

1、安装redis

  sudo apt-get install redis-server

2、查看是否安装成功

 3、开启redis远程连接

  编辑 /etc/redis/redis.conf

  注释 bind 127.0.0.1 ::1

  设置 protected-mode  no

  1、关闭protected-mode模式,此时外部网络可以直接访问

  2、开启protected-mode保护模式,需配置bind ip或者设置访问密码

  • 如果以守护进程运行,则不会在命令行阻塞,类似于服务
  • 如果以非守护进程运行,则当前终端被阻塞,无法使用
  • 推荐改为yes,以守护进程运行
    daemonize no|yes

  设置完配置文件之后重启服务:service redis-server restart

4、安装mysql

  apt install mysql-server

5、查看mysql是否安装成功

 6、开启mysql远程连接

  编辑mysql配置文件 vim /etc/mysql/mysql/mysql.conf.d/mysqld.cnf

  注释 bind-address  = 127.0.0.1

  进入mysql默认没有密码输入密码时直接回车进入

  设置授权

  grant all privileges on *.* to '用户名'@'%' identified by '登录密码' with grant option;

   flush privileges;

猜你喜欢

转载自www.cnblogs.com/blogsupermouse/p/12807337.html