# Alter existing mysql database without root password

Unzip `oldwebsitedata.tar.gz` into this directory so that you end with `./mnt/mysql-snapshot-2015-03-31/data`

Then run:

    docker-compose run mysql bash

Once inside the container run:

    mysqld_safe --skip-grant-tables &

Press enter/return. Now run:

    mysql -u root

You are now in the mysql shell. `show databases;` will show:
    
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | pmg_drupal         |
    | pmg_test           |
    +--------------------+

You can now alter the `root` user password (this is MySQL 5.1 syntax):

    UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root';
    FLUSH PRIVILEGES;

Exit out of the mysql shell and Docker container.

The database data files in the host have been modified so you don't need to do this again for those data files.

Now you can run mysql normally:

     docker-compose up

     docker exec -it CONTAINERID bash
     mysql -u root -p


## Background

The key to making this work was that `vsamov/mysql-5.1.73` needed `mysql_upgrade` on the PMG Drupal database but you need the root password to run that upgrade. `grugnog/mysql-5.1` works fine with the PMG Drupal data.