Skip to content

Unable to alter DB on mac, when using local volumes #740

Closed
@kazeshini178

Description

@kazeshini178

Currently every time I run an ALTER statement on MySQL docker instance my database schema seems too corrupt.

Current attempted the following

docker run -e MYSQL_ROOT_PASSWORD=rootPassword -v /Users/[username]/project/db-data:/var/lib/mysql -p 3307:3306 mysql:5.7

also tried in a docker-compose

mysql:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: rootPassword
    volumes:
      - ./db-data:/var/lib/mysql
    ports:
      - "3307:3306"

When I run either of these update statements I get the errors/message below

ALTER TABLE `Sample` ADD `NewColumn` longtext CHARACTER SET 'utf8mb4' NULL;
-- OR
ALTER TABLE `Sample` 
ADD COLUMN `NewColumn` LONGTEXT NULL DEFAULT NULL;
2021-02-11T15:01:33.380914Z 11 [Warning] InnoDB: Table sample contains 20 user defined columns in InnoDB, but 19 columns in MySQL. Please check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.
2021-02-11T15:01:33.380954Z 11 [Warning] InnoDB: Cannot open table sample from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.
2021-02-11T15:01:46.852926Z 3 [Note] InnoDB: Table sample is corrupted. Please drop the table and recreate it
2021-02-11T15:01:46.852947Z 3 [Warning] InnoDB: Cannot open table sample from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.

The part the confuse me is if don't use a volume that is bound to a local folder, and use a docker volume (not 100% how to describe the difference). So when I use the following everything seems to work

docker run -e MYSQL_ROOT_PASSWORD=rootPassword -v db-data:/var/lib/mysql -p 3307:3306 mysql:5.7

I think it's something specific to macOS as everything above works on Windows without any issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions