MYSQL数据库表的引擎-2 (使用与修改)

1、修改建表引擎

[sql] view plain copy print ?
  1. mysql> CREATE TABLE test_2(
  2. -> name varchar(10),
  3. -> year int(10))
  4. -> ENGINE=InnoDB; -->创建表时指定默认引擎
  5. Query OK, 0 rows affected (0.10 sec)
  6. mysql> show create table test_2\G
  7. *************************** 1. row ***************************
  8. Table: test_2
  9. Create Table: CREATE TABLE `test_2` (
  10. `name` varchar(10) DEFAULT NULL,
  11. `year` int(10) DEFAULT NULL
  12. ) ENGINE=InnoDB DEFAULT CHARSET=latin1
  13. 1 row in set (0.00 sec)
  14. mysql>
  15. mysql> show tables;
  16. +------------------+
  17. | Tables_in_excise |
  18. +------------------+
  19. | test1 |
  20. | test_1 |
  21. +------------------+
  22. 2 rows in set (0.00 sec)
  23. mysql> show create table test_1\G
  24. *************************** 1. row ***************************
  25. Table: test_1
  26. Create Table: CREATE TABLE `test_1` (
  27. `name` varchar(20) DEFAULT NULL,
  28. `year` int(5) DEFAULT NULL
  29. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 --> 默认的表引擎为MyISAM;
  30. 1 row in set (0.00 sec)
  31. mysql> alter table test_1 type=InnoDB; --> 修改表的数据引擎;
  32. Query OK, 0 rows affected, 1 warning (0.11 sec)
  33. Records: 0 Duplicates: 0 Warnings: 0
  34. mysql> show create table test_1\G
  35. *************************** 1. row ***************************
  36. Table: test_1
  37. Create Table: CREATE TABLE `test_1` (
  38. `name` varchar(20) DEFAULT NULL,
  39. `year` int(5) DEFAULT NULL
  40. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 --> 显示表的数据引擎已经变为InnoDB;
  41. 1 row in set (0.00 sec)
  42. mysql>

2、

[sql] view plain copy print ?
  1. mysql> show engines; --> 查看MySQL支持引擎
  2. +------------+---------+------------------------------------------------------------+--------------+------+------------+
  3. | Engine | Support | Comment | Transactions | XA | Savepoints |
  4. +------------+---------+------------------------------------------------------------+--------------+------+------------+
  5. | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
  6. | CSV | YES | CSV storage engine | NO | NO | NO |
  7. | MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
  8. | InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
  9. | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
  10. +------------+---------+------------------------------------------------------------+--------------+------+------------+
  11. 5 rows in set (0.00 sec)
  12. mysql>

你可能感兴趣的:(MYSQL数据库表的引擎-2 (使用与修改))