数据库安装

1.    基础知识

Enum    列举型别;

VPSVirtual Private Server 虚拟专用服务器)disk space  磁盘空间    固态硬盘(Solid State Drives),简称固盘

Random-Access Memory(随机存取存储器)    Bandwidth    带宽;Xeon英特尔公司的一款处理器,中国译名至强      下载好服务器默认的   用户名是   root

2.       数据库安装    http://www.cnblogs.com/starof/p/4680083.html

root@yl-web yl]# yum install mysql-serverLoaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.sina.cn

 * extras: mirrors.sina.cn

 * updates: mirrors.sina.cn

No package mysql-server available.

Error: Nothing to do

 

查资料发现是CentOS 7 版本将MySQL数据库软件从默认的程序列表中移除,用mariadb代替了。

有两种解决办法:

1、方法一:安装mariadb

MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。

安装mariadb,大小59 M

[root@yl-web yl]# yum install mariadb-server mariadb

mariadb数据库的相关命令是:

systemctl start mariadb  #启动MariaDB

systemctl stop mariadb  #停止MariaDB

systemctl restart mariadb  #重启MariaDB

systemctl enable mariadb  #设置开机启动

所以先启动数据库

[root@yl-web yl]# systemctl start mariadb

然后就可以正常使用mysql

 

[root@yl-web yl]# mysql -u root -pEnter password:

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 3

Server version: 5.5.41-MariaDB MariaDB Server

 

Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

MariaDB [(none)]> show databases;+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.00 sec)

 

MariaDB [(none)]>

 

安装mariadb后显示的也是 MariaDB [(none)]> ,可能看起来有点不习惯。下面是第二种方法。

 3.    mysql   安装   

https://jingyan.baidu.com/article/fec7a1e5f8d3201190b4e782.html

4.         

Linux下安装Nodejs

http://blog.csdn.net/dxywx/article/details/51396234

5......       Linux   创建文件命令       touch   文件名

 

 

 

6..............

forEachES5中操作数组的一种方法,主要功能是遍历数组,例如:

  

1

2

var arr = [1,2,3,4];

arr.forEach(alert);

 等价于:

1

2

3

4

var arr = [1, 2, 3, 4];

for (var k = 0, length = arr.length; k < length; k++) {

 alert(array[k]);

}

 forEach方法中的function回调有三个参数:第一个参数是遍历的数组内容,第二个参数是对应的数组索引,第三个参数是数组本身

因此:

  [].forEach(function(value,index,array){

    //code something

  });

等价于:

  $.each([],function(index,value,array){

    //code something

  })

写一个例子;

1

2

3

4

5

6

var arr = [1,2,3,4];

arr.forEach(function(value,index,array){

    array[index] == value;    //结果为true

    sum+=value;  

    });

console.log(sum);    //结果为 8

 

 

 

fs.writeFileSync(filename, data, [options])

由于该方法属于fs模块,使用前需要引入fs模块(var fs= require(“fs”) )

接收参数:

filename      (String)            文件名称

data        (String | Buffer)    将要写入的内容,可以使字符串 或 buffer数据。

options        (Object)           option数组对象,包含:

· encoding   (string)            可选值,默认 ‘utf8′,当data使buffer时,该值应该为 ignored。

· mode         (Number)        文件读写权限,默认值 438

· flag            (String)            默认值 ‘w'

 

 

 

 

 

 

nodejs 将数据写入xls或者xlsx文件中的代码实例

var xlsx = require(‘node-xlsx’); var fs = require(‘fs’); var obj = {“worksheets”:[{“data”:[[“姓名”,“性别”,“年龄”]]}]}; var file = xlsx.build(obj); fs.writeFileSync(‘user.xlsx’, file, ‘binary’);

 

 

 

7..........................................................

JSON.parse()和JSON.stringify()

parse用于从一个字符串中解析出json对象,

var str = '{"name":"huangxiaojian","age":"23"}'

结果:

JSON.parse(str)

Object

  1. age: "23"
  2. name: "huangxiaojian"
  3. __proto__: Object

 

注意:单引号写在{}外,每个属性名都必须用双引号,否则会抛出异常。

 

stringify()用于从一个对象解析出字符串,如

var a = {a:1,b:2}

结果:

JSON.stringify(a)

"{"a":1,"b":2}"

 

posted @ 2017-06-29 00:24  雪落无痕1  阅读(141)  评论(0编辑  收藏  举报