admin 管理员组

文章数量: 1086019

云计算上安装mysql,redis

第一步 安装

apt-get update;
apt-get install mysql-client;
apt-get install mysql-server;

第二步 解除防火墙

root@JD:~# iptables -L  
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
MYSQL_DENY  all  --  anywhere             anywhereChain FORWARD (policy ACCEPT)
target     prot opt source               destinationChain OUTPUT (policy ACCEPT)
target     prot opt source               destination
root@JD:~# iptables -F
root@JD:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destinationChain FORWARD (policy ACCEPT)
target     prot opt source               destinationChain OUTPUT (policy ACCEPT)
target     prot opt source               destinationChain MYSQL_DENY (0 references)

第三步 添加远程访问权限

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'lottery' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)mysql> exit
Bye
root@JD:~# service mysql restart

OK

redis

apt-get install redis server

修改配置/etc/redis/redis.conf ,把原来绑定的 127.0.0.1 改为0.0.0.0
后台启动redis

nohup redis-server & #1启动
jobs            #2 查看后台运行的任务
disown       #3 从jobs中移除
jobs           #4 查看没有这个任务

嗯 远程访问以下 redis-cli -h [ip]

本文标签: 云计算上安装mysql redis