valet-plus icon indicating copy to clipboard operation
valet-plus copied to clipboard

Bug: Installation fails when root user has password, still claims success

Open Leland opened this issue 3 years ago • 1 comments

  • [x] I've checked the issue queue and could not find anything similar to my bug.
  • [x] I'm on the latest version of valet-plus (valet --version): Valet+ 2.1.0
  • [x] I've run valet fix and valet install after updating and before submitting my issue/feature.

What is the problem? When a user has a password already set on MySQL, valet install will always fail. Note that #468 is around the same topic, but there's clearly more work to be done here, both in terms of messaging and documentation.

To be clear: Right now, Valet+ only installs when the root password is blank.

  1. $ mysqladmin -u root password 'foo'
    mysqladmin: [Warning] Using a password on the command line interface can be insecure.
    Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
    
$ valet install
Password:
[nginx] Stopping
[[email protected]] Stopping
[devtools] Installing tools
[wp-cli] Installing
[pv] Installing
[geoip] Installing
[zlib] Installing
[binaries] Installing binaries
[nginx] Installing
[[email protected]] Installing
[BREW TAP] henkrehorst/php already installed
[PECL] Updating PECL channel: pecl.php.net
[PECL] Installing extensions
	apcu is already installed, skipping...
	apcu is already enabled, skipping...
	geoip is already installed, skipping...
	geoip is already enabled, skipping...
	yaml is already installed, skipping...
	yaml is already enabled, skipping...
[PECL-CUSTOM] Installing extensions
[dnsmasq] Installing
[[email protected]] Installing
[[email protected]] Stopping
[[email protected]] Configuring
[[email protected]] Restarting
[redis] Installing
[mailhog] Installing
Setting password for root user failed. 

Valet installed successfully!

What is the solution? A workaround is thus: mysqladmin -u root -p password ''

If you don't know your password, you can use sudo to login. See: https://stackoverflow.com/questions/3032054/how-to-remove-mysql-root-password

But better solutions entail getting setRootPassword() to be more helpful here.

  • Allow user-entry of their existing DB password
  • Better documentation – "failed" gives the user no next steps. In reality, all they need to do is just change their password.
  • install should not be returning a success message when the DB config fails, this is definitely a failure condition

Leland avatar Dec 29 '20 21:12 Leland

@Leland This is usually caused by having [email protected] missing from your $PATH prior to running valet install, not documented anywhere but one of the things I have found prevents this issue during an install.

clnt avatar Apr 16 '21 07:04 clnt

Added information when this happens in https://github.com/weprovide/valet-plus/releases/tag/3.0.1

mischabraam avatar Feb 19 '24 16:02 mischabraam