今天我删除了一个临时表时遇到了这个奇怪的问题。我删除了临时表并描述了该表只是为了验证。但是,桌子没有掉下来。经过一番搜索,我发现:
MySQL 允许创建一个与永久表同名的临时表。所以临时表被删除了,而不是永久表。我对我正在工作的表感到非常困惑。
MySQL 版本:5.1.36-enterprise-gpl-pro-log
这是我测试过的:
mysql> create table test(id int);
Query OK, 0 rows affected (0.00 sec)
mysql> desc test;
| Field | Type | Null | Key | Default | Extra |
--------------------------------------------------
id int(11) YES NULL
mysql> create temporary table test(id int);
Query OK, 0 rows affected (0.00 sec)
mysql> desc test;
| Field | Type | Null | Key | Default | Extra |
--------------------------------------------------
id int(11) YES NULL
mysql> drop table test;
Query OK, 0 …Run Code Online (Sandbox Code Playgroud) 我需要创建一个转储文件,其中包含来自数据库的单个存储过程,而不是所有例程。
我试过这样的事情:
mysqldump -u root -pssmart --skip-triggers --no-create-info --no-data \
--no-create-db --skip-opt test_fshop SP_ITEM_SALES_REPORT -R \
> test_fshop_routines.sql
Run Code Online (Sandbox Code Playgroud)
这test_fshop是我的数据库名称,SP_ITEM_SALES是我的 SP。我想要我的 SP 作为 .sql 文件。