-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cf2403
commit c88962f
Showing
2 changed files
with
29 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
use Valet\Site; | ||
|
||
use function Valet\info; | ||
use function Valet\output; | ||
use function Valet\table; | ||
use function Valet\tap; | ||
use function Valet\warning; | ||
|
@@ -200,20 +201,10 @@ public function setRootPassword($oldPwd = '', $newPwd = self::MYSQL_ROOT_PASSWOR | |
|
||
switch ($version) { | ||
case 'mariadb': | ||
$this->cli->run( | ||
"mysqladmin -u root --password='" . $oldPwd . "' password " . $newPwd, | ||
function () use (&$success) { | ||
warning('Setting mysql password for root user failed. '); | ||
$success = false; | ||
} | ||
); | ||
break; | ||
|
||
case '[email protected]': | ||
$this->cli->runAsUser( | ||
"mysqladmin -u root --password='" . $oldPwd . "' password " . $newPwd, | ||
function () use (&$success) { | ||
warning('Setting mysql password for root user failed. '); | ||
$success = false; | ||
} | ||
); | ||
|
@@ -227,12 +218,25 @@ function () use (&$success) { | |
true | ||
); | ||
if (!$retval) { | ||
warning('Setting mysql password for root user failed. '); | ||
$success = false; | ||
} | ||
break; | ||
} | ||
|
||
if ($success === false) { | ||
warning( | ||
"\n" . | ||
'Setting mysql password for root user failed.' | ||
); | ||
output( | ||
"\n" . | ||
'You can show the current configured password with the following command:' . "\n" . | ||
' <fg=yellow>valet-plus db password --show</>' . "\n" . | ||
"\n" . | ||
'And try to set the root password manually with the following command:' . "\n" . | ||
' <fg=yellow>valet-plus db password <old> <new></>' . "\n" | ||
); | ||
} | ||
if ($success !== false) { | ||
$this->setConfigRootPassword($newPwd); | ||
} | ||
|
@@ -510,7 +514,7 @@ protected function removeConfiguration() | |
/** | ||
* Returns the stored password from the config. If not configured returns the default root password. | ||
*/ | ||
protected function getConfigRootPassword() | ||
public function getConfigRootPassword() | ||
{ | ||
$config = $this->configuration->read(); | ||
if (isset($config['mysql']) && isset($config['mysql']['password'])) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters