8

I'm trying to install Magento 2 on server which doesn't use database password. It's a kind of cloud hosting and I don't have ability to set password there.

Is there any way to install M2 using CLI with empty password?

I tried this installation command call:

cd bin/; /usr/bin/php ./magento setup:install \
        --currency=USD \
        --base-url=<URL> \
        --base-url-secure=<URL> \
        --language=en_US \
        --timezone=America/Los_Angeles \
        --db-host=<HOST> \
        --db-name=main \
        --db-user=user \
        --backend-frontname=admin \
        --admin-user=admin \
        --admin-firstname=John \
        --admin-lastname=Doe \
        [email protected] \
        --admin-password=admin12

And I got exception:

Configuration array must have a key for 'password' for login credentials  

Then I tried to provide empty password:

cd bin/; /usr/bin/php ./magento setup:install \
        --currency=USD \
        --base-url=<URL> \
        --base-url-secure=<URL> \
        --language=en_US \
        --timezone=America/Los_Angeles \
        --db-host=<HOST> \
        --db-name=main \
        --db-user=user \
        --db-password='' \
        --backend-frontname=admin \
        --admin-user=admin \
        --admin-firstname=John \
        --admin-lastname=Doe \
        [email protected] \
        --admin-password=admin12

But got another exception:

The "--db-password" option requires a value. 

Do you know if Magento 2 installation on database server which doesn't use password is supported?

It worked fine for me with Magento 1, I've just provided empty password there:

--db_pass '' \
3
  • 1
    Are you really, really sure you want to do that anyway?
    – Mike
    Dec 14, 2015 at 15:47
  • Ha, unfortunately yes. Dec 15, 2015 at 0:07
  • It worked for me: --admin-password '' without '='
    – shustr8
    Aug 18, 2016 at 10:42

2 Answers 2

9

The following works for me on Ubuntu:

./bin/magento setup:install \
    --db-host=localhost \
    --db-name=magento \
    --db-user=root \
    --backend-frontname=admin \
    --base-url=http://some.host/ \
    --language=en_US \
    --timezone=America/Chicago \
    --currency=USD \
    --admin-lastname=Admin \
    --admin-firstname=Admin \
    [email protected] \
    --admin-user=admin \
    --admin-password=123123q \
    --cleanup-database \
    --use-rewrites=1

The problem may be that you are using remote MySQL host, not localhost. Not sure that it is possible to connect to remote MySQL host without password.

2
  • I tried to add --cleanup-database option and ran setup:uninstall and it went through. I'm not sure what happened, it may be that credentials set in wrong way were cached or stored in config.php file. Thanks for help. Dec 14, 2015 at 17:32
  • remove "--db-password" option from command. Jul 17, 2018 at 11:47
0

Remove --db-password and use an alpha-numeric password of at least 7 chars for --admin-password

cd bin/; /usr/bin/php ./magento setup:install \
    --currency=USD \
    --base-url=<URL> \
    --base-url-secure=<URL> \
    --language=en_US \
    --timezone=America/Los_Angeles \
    --db-host=<HOST> \
    --db-name=main \
    --db-user=user \
    --backend-frontname=admin \
    --admin-user=admin \
    --admin-firstname=John \
    --admin-lastname=Doe \
    [email protected] \
    --admin-password=admin12
3
  • I'm sorry for confusion, I already used admin password according to requirements, I just modified my code sample to avoid showing real password there. I modified it again to show it uses proper password. However, without --db-password option I'm getting exception which looks as coming from Zend_Db_Adapter_Abstract. Dec 14, 2015 at 15:58
  • too bad, it would have been easy :) what is the version of /usr/bin/php? and could you check that php.ini used by /usr/bin/php is correctly configured? devdocs.magento.com/guides/v2.0/install-gde/…
    – csmarvz
    Dec 14, 2015 at 16:20
  • PHP looked good, it looks something got cached on previous invalid command call. Thanks! Dec 15, 2015 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.