zoukankan      html  css  js  c++  java
  • 第一章 Mysql基本概念

    mysql> create table students(
        -> student_id INT UNSIGNED,
        -> name VARCHAR(30),
        -> sex CHAR(1),
        -> birth DATE,
        -> PRIMARY KEY (student_id)
        -> );
    Query OK, 0 rows affected (0.01 sec)
    
    
    mysql> desc students
        -> ;
    +------------+------------------+------+-----+---------+-------+
    | Field      | Type             | Null | Key | Default | Extra |
    +------------+------------------+------+-----+---------+-------+
    | student_id | int(10) unsigned | NO   | PRI | 0       |       |
    | name       | varchar(30)      | YES  |     | NULL    |       |
    | sex        | char(1)          | YES  |     | NULL    |       |
    | birth      | date             | YES  |     | NULL    |       |
    +------------+------------------+------+-----+---------+-------+
    4 rows in set (0.01 sec)
    
    mysql> insert into students(student_id,name,sex,birth) values(41048101,'Lucy Green','1','1990-02-14');
    Query OK, 1 row affected (0.01 sec)
    
    mysql> select * from students;
    +------------+------------+------+------------+
    | student_id | name       | sex  | birth      |
    +------------+------------+------+------------+
    |   41048101 | Lucy Green | 1    | 1990-02-14 |
    +------------+------------+------+------------+
    1 row in set (0.00 sec)
    
    mysql> commit;
    Query OK, 0 rows affected (0.00 sec)
    
    
    mysql> select name from students where student_id = 41048101;
    +------------+
    | name       |
    +------------+
    | Lucy Green |
    +------------+
    1 row in set (0.01 sec)
    
    
    JDBC
    
    Java Data Base Connectivity (java 数据库连接) 用于Java应用程序连接数据库的标准方法,是一种用于执行SQL语句的Java API,
    
    可以为多种关系数据库提供统一访问,它由一组用Java语言编写的类和接口组成。
    
    
    Mysql 版本:
    
    -bash-4.1$ mysql -V
    mysql  Ver 14.14 Distrib 5.6.16, for Linux (x86_64) using  EditLine wrapper
    
    mysql> select version();
    +-----------+
    | version() |
    +-----------+
    | 5.6.16    |
    +-----------+
    1 row in set (0.00 sec)
    
    
    1.4 Mysql 工具:
    -bash-4.1$ ps -ef | grep mysql | grep -v grep | grep -v ps | grep -v bash
    root       557 48793  0 Mar05 pts/9    00:00:00 su - mysql
    root     48888     1  0 Mar05 pts/9    00:00:00 /bin/sh /usr/local/mysql5.6/bin/mysqld_safe --datadir=/usr/local/mysql5.6/data --pid-file=/usr/local/mysql5.6/data/dwh1.pid
    mysql    49005 48888  0 Mar05 pts/9    00:00:02 /usr/local/mysql5.6/bin/mysqld --basedir=/usr/local/mysql5.6 --datadir=/usr/local/mysql5.6/data --plugin-dir=/usr/local/mysql5.6/lib/plugin --user=mysql --log-error=/usr/local/mysql5.6/data/dwh1.err --pid-file=/usr/local/mysql5.6/data/dwh1.pid
    
    1) mysqld: SQL后台程序(即Mysql 服务器进程)。该程序必须运行之后,客户端才能连接服务器来访问数据库。
    
    
    2)mysqld_safe:服务器启动脚本,在Unix 和NetWare中推荐使用mysqld_safe来启动mysqld服务器。mysqld_safe增加了
    
    一些安全特性,例如当出现错误时重启服务器并向错误日志写入运行时间信息。
    
    
    
    
    
    
    
    
    
    
    
    

  • 相关阅读:
    IOS
    .net程序集强命名(签名)
    spring.net Corn表达式[转]
    SQLite日期类型【转】
    Use SQLite Instead of Local Storage In Ionic Framework【转】
    VS常用快捷键
    安装ASP.net mvc3 Installation failed with error code: (0x80070643), "安装时发生严重错误 "
    支付宝支付(沙箱环境相关配置)
    如何在Windows远程服务器中引入本地磁盘
    设计模式-策略模式
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351839.html
Copyright © 2011-2022 走看看