Skip to content

Instantly share code, notes, and snippets.

@blackstuend
Last active November 20, 2018 04:10
Show Gist options
  • Save blackstuend/082363472540fb5ee161b59c32667f1b to your computer and use it in GitHub Desktop.
Save blackstuend/082363472540fb5ee161b59c32667f1b to your computer and use it in GitHub Desktop.

HTTP

參考 https://blog.gtwang.org/linux/centos-7-install-mariadb-mysql-server-tutorial/

觀察http記錄檔

# cd /var/log/httpd
# tail -f access_log  //-f =follow

安裝mysql

  • mysql使用port=3306
$ yum install php-mysql
$ yum install epel-release
# sudo yum install mariadb-server   //mariadb為新的php
# sudo systemctl enable mariadb
# sudo systemctl start mariadb
# sudo mysql_secure_installation
# mysql -u root -p

  • mysql創建資料庫
create database testdb;
create user 'user'@'localhost' identified by 'user';
grant all on testdb.* to 'user'@'localhost';
show databases; //顯示創建的Databases
  • mysql 建立資料表
mysql -u user -p
create table Persons (
  name varchar(255),
  id int
);
show tables; //顯示創建的tables
insert into Person(name,id) values ('tom',1); //加入資料表
select * from Persons //查看資料表 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment