Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#1050 - Table 'wp_commentmeta' already exists

Tags:

sql

mysql

ddl

Error SQL query:

CREATE TABLE `wp_commentmeta` (
  `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `comment_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `meta_key` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `meta_value` longtext COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`meta_id`),
  KEY `comment_id` (`comment_id`),
  KEY `meta_key` (`meta_key`(191))
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
MySQL said: Documentation

#1050 - Table 'wp_commentmeta' already exists

like image 906
Daniel Guacamole Avatar asked Nov 08 '22 00:11

Daniel Guacamole


1 Answers

I came across this issue and found that even if you drop the wp_commentmeta table, you are likely to have issues with other tables like wp_comments, wp_links etc.

Hence, the solution is just to drop the whole database, re-create a fresh one and restore to that. To do this, login to mysql:

mysql -u databaseuser -p

and then run the following command on your database:

drop database wordpress_database;
create database wordpress_database;
quit;
like image 131
Oli C Avatar answered Nov 15 '22 07:11

Oli C