当前位置:Gxlcms > 数据库问题 > Mysql----基础操作

Mysql----基础操作

时间:2021-07-01 10:21:17 帮助过:5人阅读

1 row affected (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | | test | | test2 | +--------------------+ 6 rows in set (0.00 sec)
  • 查看数据库:show databases;
  1. mysql><span style="color: #000000;"><strong> create Database test2;</strong>
  2. Query OK, </span><span style="color: #800080;">1</span> row affected (<span style="color: #800080;">0.00</span><span style="color: #000000;"> sec)
  3. mysql</span>><span style="color: #000000;"> show databases;
  4. </span>+--------------------+
  5. | Database |
  6. +--------------------+
  7. | information_schema |
  8. | mysql |
  9. | performance_schema |
  10. | sys |
  11. | test |
  12. | test2 |
  13. +--------------------+
  14. <span style="color: #800080;">6</span> rows <span style="color: #0000ff;">in</span> <span style="color: #0000ff;">set</span> (<span style="color: #800080;">0.00</span> sec)
  • 选择数据库:use database_name
  1. mysql><span style="color: #000000;"> show databases;
  2. </span>+--------------------+
  3. | Database |
  4. +--------------------+
  5. | information_schema |
  6. | mysql |
  7. | performance_schema |
  8. | sys |
  9. | test |
  10. | test2 |
  11. +--------------------+
  12. <span style="color: #800080;">6</span> rows <span style="color: #0000ff;">in</span> <span style="color: #0000ff;">set</span> (<span style="color: #800080;">0.00</span><span style="color: #000000;"> sec)
  13. mysql</span>><span style="color: #000000;"><strong> use information_schema;</strong>
  14. Reading table information </span><span style="color: #0000ff;">for</span><span style="color: #000000;"> completion of table and column names
  15. You can turn off </span><span style="color: #0000ff;">this</span> feature to <span style="color: #0000ff;">get</span> a quicker startup with -<span style="color: #000000;">A
  16. <strong>Database changed #表示选择数据库成功</strong></span>
  • 删除数据库:DROP DATABASE database_name
  1. mysql><span style="color: #000000;"> show databases;
  2. </span>+--------------------+
  3. | Database |
  4. +--------------------+
  5. | information_schema |
  6. | mysql |
  7. | performance_schema |
  8. | sys |
  9. | <strong>test</strong> |
  10. | test2 |
  11. +--------------------+
  12. <span style="color: #800080;">6</span> rows <span style="color: #0000ff;">in</span> <span style="color: #0000ff;">set</span> (<span style="color: #800080;">0.00</span><span style="color: #000000;"> sec)
  13. mysql</span>><span style="color: #000000;"><strong> drop database test;</strong>
  14. Query OK, </span><span style="color: #800080;">0</span> rows affected (<span style="color: #800080;">0.00</span><span style="color: #000000;"> sec)
  15. mysql</span>><span style="color: #000000;"> show databases;
  16. </span>+--------------------+
  17. | Database |
  18. +--------------------+
  19. | information_schema |
  20. | mysql |
  21. | performance_schema |
  22. | sys |
  23. | test2 |
  24. +--------------------+
  25. <span style="color: #800080;">5</span> rows <span style="color: #0000ff;">in</span> <span style="color: #0000ff;">set</span> (<span style="color: #800080;">0.00</span> sec)
  • 查询默认存储引擎:SHOW VARIABLES LIKE ‘storage_engine%‘;
  1. mysql> show variables like <span style="color: #800000;">‘</span><span style="color: #800000;">storage_engine%</span><span style="color: #800000;">‘</span><span style="color: #000000;">;
  2. Empty </span><span style="color: #0000ff;">set</span> (<span style="color: #800080;">0.01</span> sec)

 

Mysql----基础操作

标签:with   sql   选择   format   mys   orm   for   reading   class   

人气教程排行