0

I want to install magento and I run the command below,

php bin/magento setup:install  --cleanup-database 
--base-url=“http://**.***.**.*/var/www/html/magento/“ 
--db-host=“database-1.************.***********-3.rds.amazonaws.com” 
--db-name=“magento2” 
--db-user=“admin” 
--db-password=“*********” 
--admin-firstname=“****” 
--admin-lastname=“*********” 
--admin-email=“************@gmail.com” 
--admin-user=“admin” 
--admin-password=“********” 
--language=“ja_JP” 
--currency=“JPY” 
--timezone=“Asia/Tokyo” 
--use-rewrites=“1”

Then I got an error,

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
In InstallCommand.php line 282:
  Parameter validation failed 

As a test, I tried just the first command below,

php bin/magento setup:install  --cleanup-database

also I got the same error,

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
In InstallCommand.php line 282:
  Parameter validation failed 

I think I have a problem on my database(MySql) but I'm not sure.

I am use RDS for database and running the commands on EC2.

Please help me!


Thank you for your answer. when I run your command with my db-password, i got an error like attached file... enter image description here

1
  • are you sure my sql user name is admin or root? i think your SQL username is root. Commented Mar 7 at 5:15

2 Answers 2

0
php bin/magento setup:install --base-url="http://127.0.0.1/yourprojecturl/pub" --db-host="localhost" --db-name="yourdatabasename" --db-user="root" --db-password="yoursqlpassword" --admin-firstname="magento" --admin-lastname="dev" --admin-email="[email protected]" --admin-user="admin" --admin-password="admin@123" --language="en_US" --currency="USD" --timezone="America/Chicago" --use-rewrites="1" --backend-frontname="admin" --search-engine="elasticsearch7" --elasticsearch-host="localhost" --elasticsearch-port="9200"
3
  • thank you for your anser
    – Meow
    Commented Mar 9 at 1:23
  • but I got the same error
    – Meow
    Commented Mar 9 at 1:24
  • you can run the above commands with db-password. Commented Mar 11 at 4:36
0

Please check whether the database has any password set for the root user.

I think, in your case, the password is currently blank.

To check so, you can connect to the server via SSH and run the following command:

mysql -h {hostname} -u {username} -p

Provide the value of password. If it connects to the database, use the same password for the database while installing Magento.

If not, probably you need to change the database user's password first, then you can install your Magento.

6
  • Thank you for your answer. I successfully connected to the database.
    – Meow
    Commented Mar 9 at 1:29
  • but I still can't install the magento. I got the same error. ''' SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) In InstallCommand.php line 282: Parameter validation failed '''
    – Meow
    Commented Mar 9 at 1:30
  • as I said on the first post, even the first command like below gives me the error. ''' php bin/magento setup:install ''' Do you have any clue for it??
    – Meow
    Commented Mar 9 at 1:32
  • I couldn't understand how are you getting error for 'root'@'localhost' while you are using db-host as database-1.************.***********-3.rds.amazonaws.com and db user as admin. Commented Mar 12 at 6:14
  • Hi Mohit Kumar Arora, Thank you for your answer. I'm using rds as a database and there is no root user when i check.
    – Meow
    Commented Mar 17 at 7:34

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.