Drupal 9 Issue: Table metatag_config already exists
If you have been using Drupal for a while, you may have encountered this issue while upgrading to Drupal 9 or installing a new module: "Table 'metatag_config' already exists". This error occurs when Drupal attempts to create a database table that already exists. The metatag_config table is created by the Metatag module, which is used to manage page title, description, and other meta tags for your Drupal site.
Fortunately, there is a simple solution to this issue. You can go to your Drupal database and delete the configuration related to Metatag. Here are the steps:
Step 1: Access your Drupal database
You can access your Drupal database using a database management tool such as phpMyAdmin or Adminer. Alternatively, you can use the command line interface to access your database. In this article, we will use phpMyAdmin as an example.
Step 2: Locate the configuration table
In the left-hand panel of phpMyAdmin, select your Drupal database. This will display a list of tables in your database. Look for the table named "config".
Step 3: Delete the Metatag configuration
Click on the "SQL" tab at the top of the phpMyAdmin interface. In the "Run SQL query" field, enter the following SQL command:
DELETE FROM config WHERE name LIKE '%metatag%';
This command will delete all configuration related to Metatag from the config table in your Drupal database.
Step 4: Clear Drupal cache
After deleting the Metatag configuration, it is important to clear Drupal's cache to ensure that the changes are applied. You can do this by navigating to the "Configuration" page in your Drupal site and clicking on the "Performance" link. Then, click on the "Clear all caches" button.
Conclusion
The "Table 'metatag_config' already exists" error is a common issue in Drupal 9 that can be easily fixed by deleting the Metatag configuration from the config table in your Drupal database. By following the steps outlined in this article, you can resolve this issue and get back to building your Drupal site.