Topic on Project:Support desk

#1050 - Table 'calendar' already exists

7
192.44.85.23 (talkcontribs)

SQL query:

-- -- Database: `iwpa03` -- -- -------------------------------------------------------- -- -- Table structure for table `calendar` -- CREATE TABLE `calendar` (

`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`parent_id` INT( 11 ) DEFAULT  '0',
`owner_id` INT( 11 ) DEFAULT NULL ,
`project_id` INT( 11 ) NOT NULL ,
`title` VARCHAR( 255 ) DEFAULT NULL ,
`place` VARCHAR( 255 ) DEFAULT NULL ,
`notes` TEXT,
`start_datetime` DATETIME DEFAULT NULL ,
`end_datetime` DATETIME DEFAULT NULL ,
`status` INT( 1 ) DEFAULT  '0',
`rrule` TEXT,
`visibility` INT( 1 ) DEFAULT  '0',
`participant_id` INT( 11 ) NOT NULL ,

PRIMARY KEY ( `id` ) ) ENGINE = INNODB DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;

MySQL said:

  1. 1050 - Table 'calendar' already exists

This is what i am getting when i want to inject the datebase to my other mediawiki installation

88.130.80.115 (talkcontribs)

If you want to replace the table "calendar" with another one, you should delete the old table before. (Another solution would be to make sure that the DB dump, which you want to import, contains "DROP IF EXISTS" statements for each table. They will prevent this error as well).

192.44.85.23 (talkcontribs)

Hello i tried to insert DROP TABLE IF EXISTS `calendar` for each table is this the correct syntax if so i am getting error like this Error SQL query:

[...]

MySQL said:

  1. 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Rar!��' at line 1
88.130.80.115 (talkcontribs)

Just go to the DB, in which you want to replace the table, delete it and import it again. As simple as that.

192.44.85.23 (talkcontribs)

How to edit the table i am new to mysql please

88.130.80.115 (talkcontribs)

Use a tool like PHPMyAdmin. It has a graphical user interface and is really easy to use.

On the command line things become way more complicated (at least for unexperienced users like you):

You will have to log in, select the database and drop the table, e.g. with something like this:

mysql -u my-mysql-username -pmy-mysql-password
use my-database-name
DROP TABLE `calender`;

where you have to replace everything starting with "my-" with your actual names.

78.87.116.180 (talkcontribs)

Delete the database and rename the sql database and import again put.

Reply to "#1050 - Table 'calendar' already exists"