1,使用 LIKE 从句,查看与 test_db 完全匹配的数据库:
mysql> SHOW DATABASES LIKE 'test_db';
+--------------------+
| Database (test_db) |
+--------------------+
| test_db |
+--------------------+
1 row in set (0.03 sec)
2,使用 LIKE 从句,查看名字中包含 test 的数据库:
mysql> SHOW DATABASES LIKE '%test%';
+--------------------+
| Database (%test%) |
+--------------------+
| db_test |
+--------------------+
| db_test_db |
+--------------------+
| test_db |
+--------------------+
3 row in set (0.03 sec)
3,使用 LIKE 从句,查看名字以 db 开头的数据库:
mysql> SHOW DATABASES LIKE 'db%';
+----------------+
| Database (db%) |
+----------------+
| db_test |
+----------------+
| db_test_db |
+----------------+
2 row in set (0.03 sec)
4,使用 LIKE 从句,查看名字以 db 结尾的数据库:
mysql> SHOW DATABASES LIKE '%db';
+----------------+
| Database (%db) |
+----------------+
| db_test_db |
+----------------+
| test_db |
+----------------+
2 row in set (0.03 sec)