Link to home
Start Free TrialLog in
Avatar of rperry_wha
rperry_wha

asked on

mysql table exists and doesn't

I am trying to restore from a dump:

DROP TABLE IF EXISTS `patients`;
CREATE TABLE `patients` (
  `patientID` int(11) NOT NULL auto_increment,
  `QS1CODE` varchar(24) character set utf8 collate utf8_bin default NULL,
  `DoctorCode` int(11) default NULL,
....
  PRIMARY KEY  (`patientID`)
) ENGINE=InnoDB AUTO_INCREMENT=184163 DEFAULT CHARSET=utf8;



And I get:

ERROR 1051 (42S02): Unknown table 'patients'
ERROR 1050 (42S01): Table 'patients' already exists
ERROR 1146 (42S02): Table 'rperry_wha.patients' doesn't exist
ERROR 1146 (42S02): Table 'rperry_wha.patients' doesn't exist
ERROR 1146 (42S02): Table 'rperry_wha.patients' doesn't exist
ERROR 1146 (42S02): Table 'rperry_wha.patients' doesn't exist
ERROR 1146 (42S02): Table 'rperry_wha.patients' doesn't exist
ERROR 1146 (42S02): Table 'rperry_wha.patients' doesn't exist
Avatar of racek
racek
Flag of Sweden image

add name of the schema

DROP TABLE IF EXISTS perry_wha.patients;
Avatar of rperry_wha
rperry_wha

ASKER

I've tried that:

mysql> use rperry_wha;
Database changed
mysql> drop table rperry_wha.patients;
ERROR 1051 (42S02): Unknown table 'patients'
mysql> FLUSH TABLES;
Query OK, 0 rows affected (0.00 sec)

mysql> drop table rperry_wha.patients;
ERROR 1051 (42S02): Unknown table 'patients'
mysql> FLUSH TABLES WITH READ LOCK;
Query OK, 0 rows affected (0.00 sec)

mysql> UNLOCK TABLES ;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH TABLES WITH READ LOCK;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH TABLES;
Query OK, 0 rows affected (0.00 sec)

mysql> drop table rperry_wha.patients;
ERROR 1223 (HY000): Can't execute the query because you have a conflicting read lock
ASKER CERTIFIED SOLUTION
Avatar of Umesh
Umesh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial