LNMP

LNMP = Linux + Nginx + mySQL + PHP

another LNAMP, A = Apache, httpd used in embedded system

nginx

default config /etc/nginx/nginx.conf

add server to /etc/nginx/conf.d/

  • mount nginx config
$ umount /etc/nginx/conf.d/
$ mount -B ./conf.d /etc/nginx/conf.d/
$ nginx -s reload
  • mount sourcee
    $ umount /usr/share/nginx/
    $ mount -B ~/fullstack /usr/share/nginx
    

php

default config /etc/php-fpm.d/www.conf

mysql

  • show random password generated after install

    $ grep 'temporary password' /var/log/mysqld.log
    
  • login mySQL with password

    $ mysql -u root -p
    
  • change passowrd

mysql>  ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_passwd'; // length >= 8

Database

  • show databases
mysql> show databases;
  • creat databases
$ mysqladmin -u root -p create database_name
  • import sql file
$ mysql -u root -p database_name < file_name.sql

or

mysql> source file_name.sql;
  • select database
mysql> use database_name;
  • delete database
$ mysqladmin -u root -p drop RUNOOB
  • backup database
$ mysqldump -u root -p table_name > dump.sql

Table

  • show tables
mysql> show tables;
myaql> desc table_name;
  • creat table
mysql> CREATE TABLE `cnarea_2016` (
  `id` mediumint(7) unsigned NOT NULL AUTO_INCREMENT,
  `parent_id` mediumint(7) unsigned NOT NULL DEFAULT '0' COMMENT '父级ID',
  `level` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '层级',
  `area_code` bigint(12) unsigned NOT NULL DEFAULT '0' COMMENT '行政代码',
  `zip_code` mediumint(6) unsigned zerofill NOT NULL DEFAULT '000000' COMMENT '邮政编码',
  `city_code` char(6) NOT NULL DEFAULT '' COMMENT '区号',
  `name` varchar(50) NOT NULL DEFAULT '' COMMENT '名称',
  `short_name` varchar(50) NOT NULL DEFAULT '' COMMENT '简称',
  `merger_name` varchar(50) NOT NULL DEFAULT '' COMMENT '组合名',
  `pinyin` varchar(30) NOT NULL DEFAULT '' COMMENT '拼音',
  `lng` decimal(10,6) NOT NULL DEFAULT '0.000000' COMMENT '经度',
  `lat` decimal(10,6) NOT NULL DEFAULT '0.000000' COMMENT '维度',
  PRIMARY KEY (`id`),
  KEY `idx_lev` (`level`,`parent_id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='中国行政地区表';
  • import table

  • delete table

myaql> drop table table_name;
  • quire
mysql> select * from tableName where created like '%admin%' order by time desc limit 100;

7z

$ yum install p7zip -y
$ 7za e fileName.7z // Uncompress
$ 7za a backup.7z backup/  //Compress

results matching ""

    No results matching ""