• 第一章 基本操作


    创建数据库

    mysql> create database example;

    Query OK, 1 row affected

    查看已存在的数据库

    mysql> show databases;

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

    | Database |

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

    | information_schema |

    | MyCloudDB |

    | example |

    | mydatabase |

    | mysql |

    | performance_schema |

    | sampledb |

    | user_db |

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

    8 rows in set

    删除数据库

    mysql> drop database example;

    Query OK, 0 rows affected

    数据库存储引擎

    查看支持的存储引擎

    mysql> show engines;

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

    | Engine | Support | Comment | Transactions | XA | Savepoints |

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

    | MyISAM | YES | MyISAM storage engine | NO | NO | NO |

    | CSV | YES | CSV storage engine | NO | NO | NO |

    | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |

    | BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |

    | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |

    | PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |

    | ARCHIVE | YES | Archive storage engine | NO | NO | NO |

    | InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |

    | FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |

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

    9 rows in set

    MyISAM和InnoDB存储引擎的区别

      MyISAM InnoDB
    构成 由表定义文件、数据文件和索引文件构成 由表空间数据文件和日志文件构成
    事务 不支持 支持
    操作 SELECT操作性能更好 INSERT和UPDATE性能更好
    表的具体行数

    select count(*) from table,MyISAM只要简单的读出保存好的行数,

    注意的是,当count(*)语句包含   where条件时,两种表的操作是一样的

    InnoDB 中不保存表的具体行数,也就是说,执行select count(*) from table时,InnoDB要扫描一遍整个表来计算有多少行

    表锁

    提供行锁,提供不加锁读取,另外,InnoDB表的行锁也不是绝对的,如果在执行一个SQL语句时MySQL不能确定要扫描的范围,InnoDB表同样会锁全表,例如update table set num=1 where name like “%aaa%”

    InnoDB和Myisam区别点击这里

    查看默认存储引擎

    mysql> show variables like 'storage_engine';

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

    | Variable_name | Value |

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

    | storage_engine | InnoDB |

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

    1 row in set

      

  • 相关阅读:
    Expectation Maximization Algorithm
    Cramer-Rao Bounds (CRB)
    宽带DOA估计方法
    Statistical Methods for Machine Learning
    Bootstrap Method
    算法学习————猫树
    扩展KMP详解
    网络流的模型和应用
    [CQOI2011]动态逆序对
    CF1278F Cards
  • 原文地址:https://www.cnblogs.com/wuchaodzxx/p/5524763.html
Copyright © 2020-2023  润新知