Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 명령어
- github
- date
- 라즈베리파이 실습
- 리눅스 커맨드
- 웹사이트
- 컴활 1급
- git merge
- 서버 백업
- Linux
- 라즈베리
- 블로그 만들기
- 서버
- 라즈베리 파이
- 웹 만들기
- 컴퓨터 활용능력
- windows10
- IRC 서버
- batflat
- 웹 서버
- github command
- OverTheWire
- 리눅스 사용자
- 웹 유저
- 라즈베리파이
- git branch
- 우분투 설치
- 커맨드
- java
- 리눅스
Archives
- Today
- Total
돌공공돌
라즈베리파이로 chat-room service를 제공하기! 본문
1. MariaDB 설치 (super user로 세팅)
설치 : apt-get -y install mariadb-server
기본 설정파일 수정
vim /etc/mysql/mariadb.conf.d/50-server.cnf
vim /etc/mysqlmariadb.conf.d/50-client.cnf
9번 째 줄에 아래의 코드를 입력해 주세요.
default-character-set = utf8
서버 재시작을 해줘요.
service mysql restart
mariadb root 비밀번호를 생성해 줘요.
mysql -u root -p
DB Engine 설치 및 테스트 - 2
특정 사용자를 위한 DB 만들기
필요한 사항 :
1) 사용자용 DB
2) DB 접근 사용자명
3) 비밀번호
create database userdb;
grant all privileges on userdb.* to 'db_LCH'@'localhost' identified by '1234';
flush privileges;
quit
mysql -u db_LCH -p
[input your password] '1234'
use userdb;
use mysql;
quit
DB Engine 설치 및 테스트 - 3
step 1 : 서버 관리자에게 웹서비스 세팅 확인 요청
server {
listen 80;
listen [::]:80;
server_name kkim.com;
root /home/kkim/html;
index index.html index.php;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
step2 : PHP + MYSQL 사용하는 웹사이트 소스 제작 (CLONE)
git clone https://github.com/kkim-hgu/Chat-Room
step3 : 서버관리자부터 받은 DB 정보 반영
vim Chat-Room/connection.php
<?php
$host = "localhost";
$user = "db_LCH";
$pass = "1234";
$db_name = "userdb";
$con = new mysqli($host, $user, $pass, $db_name);
function formatData($date){
return date('g:i a', strtotime(&date));
}
?>
step4 : 사용자 DB에 테이블 생성
mysql -u db_LCH -p userdb < Chat-Room/database/chat.sql
step5 : 웹사이트 접속 테스트
설정할 것
/etc/mysql/mariadb.conf.d/50-client.cnf
#Default is Latin1, if you need UTF-8 set this (also in server section);
#default-character-set = utf8mb4;
default-character-set = utf8
/etc/mysql/mariadb.conf.d/50-server.cnf
#*Character sets;
#
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full;
# utf8 4-byte character set. See also client.cnf;
#
#character-set-server = utf8mb4;
#collation-server = utf8mb4_general_ci;
init_connect=SET collation_connection = utf8_general_ci;
init_connect=SET NAMES utf8;
character-set-server=utf8;
collation-server=utf8_general_ci;
lower_case_table_names = 1
'IT > 라즈베리파이' 카테고리의 다른 글
Wordpress 설치하기 🐛🐷 (0) | 2020.06.07 |
---|---|
Server Backup 하기~🐣🐤🐥 (0) | 2020.06.07 |
Batflat 관리자 모드 탐방하기 🤖 (0) | 2020.05.29 |
라즈베리파이로 블로그용 가상 호스트를 만들자!😋 (0) | 2020.05.27 |
라즈베리파이로 만든 웹 사이트의 내용을 바꿔보아요.💩 (0) | 2020.05.22 |
Comments