0

I installed Magento 2.4.3 in ubuntu, but when I run the below command it gave me errors like,

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)

Command:

php bin/magento setup:install --base-url="http://127.0.0.1/m243" --db-host="localhost" --db-name="m243" --db-user="root" --db-password="test@!123" --admin-firstname="admin" --admin-lastname="admin" --admin-email="admin@gmail.com" --admin-user="admin" --admin-password="admin@123" --language="en_US" --currency="USD" --timezone="America/Chicago" --use-rewrites="1" --search-engine="elasticsearch7" --elasticsearch-host="localhost" --elasticsearch-port="9200"

but when I login into PHPMyAdmin using the same id password of the database

user name: root, password: test@!123

it was worked but did not work in the terminal when I run the command.

please help me with this.

1
  • Confirm that Magento install directory is named m243 and it's not just your database name ?
    – Claims
    Oct 11 '21 at 13:57
0

Try the host as 127.0.0.1 and not localhost as technically they are different

0

If the database is created and the issue still persists then try the command like this i.e. without the quotes ".

bin/magento setup:install --base-url=http://127.0.0.1/magento2/ \
--db-host=localhost 
--db-name=magento 
--db-user=magento 
--db-password=magento \
--admin-firstname=Magento
--admin-lastname=User 
--admin-email=user@example.com \
--admin-user=admin 
--admin-password=admin123 
--language=en_US \
--currency=USD 
--timezone=America/Chicago 
--use-rewrites=1 \
--search-engine=elasticsearch7 
--elasticsearch-host=es-host.example.com \
--elasticsearch-port=9200
0
  1. Log in to the MariaDB/MySQL shell using the mysql command below.

mysql -u root -p

Now create a new database for Magento installation. Create the database 'magentodbatabase' and the user 'magentodatabaseuser' with the password 'magentodbpassword'.

  1. Run the MySQL queries below.

    create database magentodbatabase;

    create user magentodatabaseuser@'localhost' identified by 'magentodbpassword';

    grant all privileges on magentodbatabase.* to magentodatabaseuser@'localhost';

    flush privileges;

  2. Now type 'exit' to log out from the MySQL shell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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