#yum install -y libaio wget
# cd /tmp # wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm # yum localinstall mysql80-community-release-el7-1.noarch.rpm
# yum install -y mysql-community-server
# service mysql start //启动 #service mysql stop //关闭
# service mysql stop
# use mysql; //mysql中以;结束 # select host,user from user; //查看现有用户 # CREATE USER 'king'@'localhost' IDENTIFIED BY '123456'; # // king为用户名,但是只为本主机可以操作,密码为123456 # select host,user from user; //再次查看用户 //赋权限 localhost更改% # GRANT ALL PRIVILEGES ON *.* TO 'king'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; //king表示用户名,%表示所有的电脑都可以连接,也可以设置某个ip地址运行连接,第二个123456表示密码、
# vim /etc/my.conf //或者 # vim /etc/mysql/mysql.conf.d/mysqld.cnf # vim /etc/mysql/my.cnf //进去将# bing-address = 127.0.0.1 注释掉或改成 0.0.0.0
// 5.7版本下的mysql数据库下已经没有password # mysql> use mysql; Database changed mysql> select User from user; #此处为查询用户命令 +-----------+ | User | +-----------+ | ******* | | mysql.sys | | root | +-----------+ 3 rows in set (0.00 sec) mysql> update user set password=password("*******") where user="*******"; #修改密码报错 ERROR 1054 (42S22): Unknown column 'password' in 'field list' # mysql> update mysql.user set authentication_string=password('123456') where user='king'; //修改密码成功 用户king 密码123456 Query OK, 1 row affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 1 # mysql> flush privileges; #立即生效 Query OK, 0 rows affected (0.00 sec) # mysql> quit Bye # mysql -u ******* -p #以该用户登录成功. Enter password: ******** ………………………… mysql>
Navicat远程登录测试,记得开放服务器3306端口和服务器防火墙
# firewall-cmd --list-ports # firewall-cmd --zone=public --add-port=3306/tcp --permanent # systemctl restart firewall.service //防火墙配置
# wget http://download.redis.io/releases/redis-4.0.8.tar.gz //获取资源 # tar xzvf redis-4.0.8.tar.gz //解压缩
# cd redis-4.0.8 //进入目录 # make //编译 # cd src # make install PREFIX=/usr/local/redis //再编译
# cd ../ # mkdir /usr/local/redis # mv redis.conf /usr/local/redis
# vim /usr/local/redis/redis.conf //将daemonize no 改成 daemonize yes
# /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf
# cp /usr/local/redis/bin/redis-server /usr/local/bin/ # cp /usr/local/redis/bin/redis-cli /usr/local/bin/ //将redis-cli,redis-server拷贝到bin下,让redis-cli指令可以在任意目录下直接使用
进入redis的配置文件
vim /etc/local/redis/redis.conf 修改内容 # bind 0.0.0.0 //所有地址均可访问 # protected-mode no //不受保护 # requirepass 123456 //密码
# redis-cli -h 127.0.0.1 -p 6379 -a 123456 输入 redis-cli 进入命令模式,使用 auth '123456'
# firewall-cmd --list-ports # firewall-cmd --zone=public --add-port=6379/tcp --permanent //(开放6379端口) # systemctl restart firewall.service //防火墙配置
常用命令 # redis-server /usr/local/redis/etc/redis.conf //启动redis # pkill redis //停止redis
## 解压 tar -zxvf nginx-1.9.9.tar.gz ##进入nginx目录 cd nginx-1.9.9 ## 配置 ./configure --prefix=/usr/local/nginx # make make make install
# cd到刚才配置的安装目录 /usr/loca/nginx/ ./sbin/nginx -t
错误信息:
nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (2: No such file or directory)
2016/09/13 19:08:56 [emerg] 6996#0: open() "/usr/local/nginx/logs/access.log" failed (2: No such file or directory)
原因分析:
nginx/目录下没有logs文件夹
mkdir logs chmod 700 logs
cd /usr/local/nginx/sbin ./nginx //启动nginx
vim /usr/local/nginx/nginx.conf //http 部分内容需要更改 //root 目录需要指向前端文件夹 //默认80端口 worker_processes auto; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 4096; include /opt/soft/nginx/conf/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/*.conf; server { listen 80; server_name image_server; location / { root /opt/project/nayun/dk-ui; try_files $uri $uri/ /index.html; index index.html index.htm; } location /prod-api/{ proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://localhost:8080/; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
# firewall-cmd --list-ports # firewall-cmd --zone=public --add-port=80/tcp --permanent //(开放80端口) # systemctl restart firewall.service //防火墙配置
//连接mysql数据库配置 # 库数据源 master: url: jdbc:mysql://123.56.120.32:3306/nayun?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: 123456 //连接Redis库配置 redis: # 地址 host: 123.56.120.32 # 端口,默认为6379 port: 6379 # 数据库索引 database: 10 # 密码 password: 123456 # 连接超时时间 timeout: 10s
nohup java SocketServer >nohup.out & //nohup 和 & 是保证后台运行不终止的意思 //>nohup 是将日志重定向输出到nohup.out文件中