This question relates to Dbdeployer
The section in question:
Users:
root, with the default grants as given by the server version being installed.
I have an instance installed on port 5730 and port 5731 respectively.  (Corresponds to MySQL 5.7.30 and 5.7.31).
I can connect like this:
mysql -u msandbox -p -h 127.0.0.1 -P 5730
mysql -u msandbox -p -h 127.0.0.1 -P 5731
mysql -u mycustomusername -p -h 127.0.0.1 -P 5730
I created a file for grants like shown in the article:
use the option
--post-grants-sql-fileto load the instructions.
> cat << EOF > orchestrator.sql
CREATE DATABASE IF NOT EXISTS orchestrator;
CREATE USER orchestrator IDENTIFIED BY 'msandbox';
GRANT ALL PRIVILEGES ON orchestrator.* TO orchestrator;
GRANT SELECT ON mysql.slave_master_info TO orchestrator;
EOF
$ dbdeployer deploy single 5.7 \
  --post-grants-sql-file=$PWD/orchestrator.sql
This works fine for a new empty database deployed by the SQL script (and its grants), but I now have an existing instance, and want to create a new database from within the mysql instance.
The article claims that root should be available, but:
mysql -u root -p -h 127.0.0.1 -P 5731
Access denied for user 'root'@'localhost' (using password: YES)
I have the local instance installed on 3306, but this is not supposed to be the user I need to login with.
When I do this:
mysql -u root -p -h localhost -P 5731
I am able to login, _however this seems to ignore the port (when connecting as localhost) because I see different databases (those on port 3306 and not those from 5730/5731)!
This also confirms my suspicion that port gets ignored :
SHOW GRANTS FOR mycustomusername;
ERROR 1141 (42000): There is no such grant defined for user 'mycustomusername' on host '%'
SHOW GLOBAL VARIABLES LIKE '%port%';
.... truncated ....
port   | 3306
I need to use root@host5731 and root@host5730  but there does not seem a way to use root here?
I need to do one (either) of the following:
- Use rootuser at these ports,
- Get a way to let msandboxormycustomusernameto be able to have ability to doGRANT ALL PRIVILEGESon a new database.
Why?
I cannot remove/recreate a new MySQL instance to add new databases (using the SQL file method) --post-grants-sql-file when I already have existing databases.
 
                        
Dbdeployer instances and setup installed and configures the password for
rootto be the same password as the username specified (default usernamemsandbox).You cannot do this (even though some answers on the github repo claim you can)
Rather what happens (and not clearly mentioned anywhere easily accessible) is that you can do the following:
Dbdeployer setup then deploys this
someuserANDrootto have the same password (somepassword).More information:
I found that I could do this:
(Not specifying the password here.) Inspecting the
./usescript, it greps the password from your configuration (which is the password forsomeuser.This then gives us the ability to login via
rootto change grants:I have now changed the password from inside:
This prevents you from externally using
./use -u rootas the password is now different than the other user.