firewalld 3306/tcp
1.DNS
yum install net-tools -y
yum install bind* -y
yum install httpd*
yum install openssl
yum install mod_ssl
yum install php* --skip-broken
yum install mariadb* -y
service mariadb* restart
2.웹서버 코드
cd /var/www/html
vi index.php
vi login.html
vi join.html
mkdir -p /var/www/html/proc
vi login_proc.php
vi join_proc.php
3.웹서버 디렉토리 인덱싱 x
vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
:140
Options Indexes FollowSymLinks -> Options
service httpd restart
4.mysql 한글설정
vi /etc/my.cnf
[mysqld]
character-set-server=utf8
[client]
default-character-set=utf8
alter database SB default character set utf8;
alter table class default character set utf8;
alter table class convert to character set utf8
5.mysql에서 필요없는 사용자 삭제
mysql -u root -p
use mysql
delete from user where user='';
6. root비번 asd123
update user set password=password('asd123') where user='root';
7. php코드보고 테이블설정
vi login_proc.php
mysql_connect("db.sevas10.com","sevas","asd123") or die ("NET 연결오류");
echo "connect success<br>";
mysql_select_db(SB) or die ("DB 연결실패");
vi join_proc.php
mysql_connect("db.sevas10.com","sevas","asd123") or die ("mysql Fail");
echo "Connect Mysql<br>";
mysql_select_db(SB) or die ("DB Fail");
8. db=SB table=class 계정 sevas
create database SB;
grant all privileges on *.* to sevas@'192.168.10.10' identified by 'asd123';
grant all privileges on *.* to sevas@'www.sevas10.com' identified by 'asd123';
flush privileges;
select host,user,password from user;
GRANT USAGE ON [DB].[TABLE] TO [계정]@['192.168.10.10/www.sevas10.com'] IDENTIFIED BY '비번';
GRANT ALL PRIVILEGES ON [DB].* TO [계정]@['192.168.10.10/www.sevas10.com'] WITH GRANT OPTION;
grant all privileges on SB.* to sevas@'192.168.10.10' identified by 'ads123';
]
flush privileges;
use SB;
create table class (
no int auto_increment unique not null,
id char(40) primary key,
pw char(40) not null,
nick varchar(40) not null,
reg_date datetime,
index (no),
unique sevas(no,id));
show create table;
select host,user,password from user;
#9.비번 암호화
vi join_proc.php
$sql = "insert into korea values ('','$id',hex(aes_encrypt('$pw',sha2('sevas',512))),'$nick',now())";
#10. 로그인시 복호화
vi login_proc.php
#$sql="select id,pw from korea where id='$id' and pw='$pw'";
$sql="select id,aes_decrypt(unhex(pw),sha2('sevas',256)) from class where id='$id' and pw=aes_decrypt(unhex(pw),sha2('sevas',256))='$pw'";
11. 전체백업
mysqldump -u root -pasd123 -A > all.sql
[www.sevas10.com]
yum install mariadb* -y
service mariadb restart
mkdir /backup
cd /backup
scp db.sevas10.com:/backup/* ./
[전체 백업복구]
mysql -u root -p < all.sql
my
1.
mysql 들어가서 \s
2.
use SB
show create table class;
3.mysql root 들어가서
use mysql
select host,user,password from user;
4,
insert into class values ('','sevas',hex(aes_encrypt('asd123',sha2('test',512))), '$nick',now());
select id,aes_decrypt(unhex(pw),sha2('test',512)) from class where id='sevas';
6.
insert into class values ('','sevas',hex(aes_encrypt('asd123',sha2('test',512))),'세바스',now());
select * from class;
7.
select aes_decrypt(unhex('7EF147A7C43B00A81ABA1D550BA855AC'),sha2('test',512));