Okay, good news - have managed to fix this - am relieved! Bit complex. First stopped my stack in Indigo and copied the contents of the complete-but-inaccessible MySQL ..._data
folder into the newly-created-but-empty one, having deleted the contents of that first.
Next ran the internal mysql daemon using the default/original uncustomised my.cnf
file and with the skip-grant-tables
option so it doesn't check credentials:
/Users/[me]/.indigo/stacks/[STACKID]/mysql_[ID]/bin/mysqld --defaults-file=/Users/[me]/.indigo/stacks/[STACKID]/mysql_[ID]/conf-original/my.cnf --datadir=/Users/[me]/.indigo/stacks/[STACKID]/mysql_[ID]_data --skip-grant-tables
Then in separate terminal opened the mysql client:
mysql -u root
Then ran:
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
mysql> EXIT;
After exiting out, I killed the mysqld process then initiated a new mysqld process just for testing with the Indigo customised my.cnf
file and without the skip-grant-tables
option:
/Users/[me]/.indigo/stacks/[STACKID]/mysql_[ID]/bin/mysqld --defaults-file=/Users/[me]/.indigo/stacks/[STACKID]/mysql_[ID]/conf/my.cnf --datadir=/Users/[me]/.indigo/stacks/[STACKID]/mysql_[ID]_data
....which seemed to work fine. Killed that then returned to Indigo and started my stack, to find all was working fine and my data was perfectly accessible.
All in all rather strange and not really sure of the cause! In my travels I did find the 1-users-databases.sql
file in the mysql 'scripts' folder, and for MySQL v8 and up I think the line...
SET PASSWORD FOR 'root'@'localhost' = 'password';
...should be replaced with
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
That file also talks about "generated commands to create the required databases [...] also grant all privileges to all users on all databases [...] feel free to remove these GRANTs and provide your own" but there are no further lines in the file, not sure if that could have anything to do with it? Anyway, all is well that ends well!