SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 7
- Joined: 03 Jun 2022, 17:50
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
I kept on running into the following errors
I install XAMPP and Composer first then tried to running the following cmd:
composer create-project aimeos/aimeos myshop
and it ran fine in command prompt.
and everything seem successful until the following when creating the database. To create the database i just follow the following instruction but i sure i might be missing some steps maybe? I am also not to sure about the .env as i tried playing around with a few suggested changes but seem to do nothing... I did following suggestion from this link:
viewtopic.php?f=18&t=871&p=3654&hilit=S ... t%27#p3654
but didnt get good result. I tried for the last few days and was unsuccessful and as I am not a software expert but defnintely learning and curious how to set this up. Thanks!!!
> App\Composer::configure
Database setup
- DB_CONNECTION (mysql):
- DB_HOST (127.0.0.1):
- DB_PORT (3306):
- DB_DATABASE (laravel):
- DB_USERNAME (root):
- DB_PASSWORD:
Mail setup
- MAIL_MAILER (smtp):
- MAIL_HOST (smtp.mailtrap.io):
- MAIL_PORT (2525):
- MAIL_USERNAME ():
- MAIL_ENCRYPTION ():
- MAIL_PASSWORD:
> @php artisan migrate
Illuminate\Database\QueryException
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')
at C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connection.php:742
738▕ // If an exception occurs when attempting to run a query, we'll format the error
739▕ // message to include the bindings with SQL, which will make this exception a
740▕ // lot more helpful to the developer instead of just the database's errors.
741▕ catch (Exception $e) {
➜ 742▕ throw new QueryException(
743▕ $query, $this->prepareBindings($bindings), $e
744▕ );
745▕ }
746▕ }
1 C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)")
2 C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=laravel", "root", "aimeosaimeos", [])
Script @php artisan migrate handling the post-create-project-cmd event returned with error code 1
C:\Users\ADMIN\Desktop\SoftwareIndependent>
I install XAMPP and Composer first then tried to running the following cmd:
composer create-project aimeos/aimeos myshop
and it ran fine in command prompt.
and everything seem successful until the following when creating the database. To create the database i just follow the following instruction but i sure i might be missing some steps maybe? I am also not to sure about the .env as i tried playing around with a few suggested changes but seem to do nothing... I did following suggestion from this link:
viewtopic.php?f=18&t=871&p=3654&hilit=S ... t%27#p3654
but didnt get good result. I tried for the last few days and was unsuccessful and as I am not a software expert but defnintely learning and curious how to set this up. Thanks!!!
> App\Composer::configure
Database setup
- DB_CONNECTION (mysql):
- DB_HOST (127.0.0.1):
- DB_PORT (3306):
- DB_DATABASE (laravel):
- DB_USERNAME (root):
- DB_PASSWORD:
Mail setup
- MAIL_MAILER (smtp):
- MAIL_HOST (smtp.mailtrap.io):
- MAIL_PORT (2525):
- MAIL_USERNAME ():
- MAIL_ENCRYPTION ():
- MAIL_PASSWORD:
> @php artisan migrate
Illuminate\Database\QueryException
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')
at C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connection.php:742
738▕ // If an exception occurs when attempting to run a query, we'll format the error
739▕ // message to include the bindings with SQL, which will make this exception a
740▕ // lot more helpful to the developer instead of just the database's errors.
741▕ catch (Exception $e) {
➜ 742▕ throw new QueryException(
743▕ $query, $this->prepareBindings($bindings), $e
744▕ );
745▕ }
746▕ }
1 C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)")
2 C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=laravel", "root", "aimeosaimeos", [])
Script @php artisan migrate handling the post-create-project-cmd event returned with error code 1
C:\Users\ADMIN\Desktop\SoftwareIndependent>
Re: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
You have to create a database in your MySQL server first and then enter the correct database, user and password when the setup script is asking for.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 7
- Joined: 03 Jun 2022, 17:50
Re: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
Thanks you your team are really quick to response
I created a few database but not sure if i link it correctly: and i change my .env to the following:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myshop
DB_USERNAME=root
DB_PASSWORD=xxxx
and did the following:
php artisan migrate:fresh
but still give the error:
Illuminate\Database\QueryException
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')
at C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connection.php:742
738▕ // If an exception occurs when attempting to run a query, we'll format the error
739▕ // message to include the bindings with SQL, which will make this exception a
740▕ // lot more helpful to the developer instead of just the database's errors.
741▕ catch (Exception $e) {
➜ 742▕ throw new QueryException(
743▕ $query, $this->prepareBindings($bindings), $e
744▕ );
745▕ }
746▕ }
1 C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)")
2 C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=mysql", "root", "aimeos", [])
I created a few database but not sure if i link it correctly: and i change my .env to the following:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myshop
DB_USERNAME=root
DB_PASSWORD=xxxx
and did the following:
php artisan migrate:fresh
but still give the error:
Illuminate\Database\QueryException
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')
at C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connection.php:742
738▕ // If an exception occurs when attempting to run a query, we'll format the error
739▕ // message to include the bindings with SQL, which will make this exception a
740▕ // lot more helpful to the developer instead of just the database's errors.
741▕ catch (Exception $e) {
➜ 742▕ throw new QueryException(
743▕ $query, $this->prepareBindings($bindings), $e
744▕ );
745▕ }
746▕ }
1 C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)")
2 C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=mysql", "root", "aimeos", [])
Re: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
Create a new user/password that is allowed to connect to the server. Use the "mysql" command at the command line to test if the user/password combinations works when connecting to "localhost".
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 7
- Joined: 03 Jun 2022, 17:50
Re: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
I see thanks!!! It seem like mysql is not working:
When running it in windows command line:
I used XAMPP will that cause issues? As XAMPP is running my sql database right now. And I don't think windows command line realized that or pick it up and let me use "mysql" in the cmd probably why i am getting that error.
I just tried the following and it fail:
I assume I have to go install mysql as followed:
How to Install MySQL on Windows10? | MySQL Tutorial for Beginners | MySQL Training
FYI in case someone needs this in the future:
https://www.youtube.com/watch?v=GIRcpjg-3Eg
Thanks!
When running it in windows command line:
Code: Select all
C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop>mysql -h 127.0.0.1 -u root -p aimeos
'mysql' is not recognized as an internal or external command,
operable program or batch file.
Code: Select all
C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop>pip install mysql
Collecting mysql
Downloading mysql-0.0.3-py3-none-any.whl (1.2 kB)
Collecting mysqlclient
Downloading mysqlclient-2.1.0-cp310-cp310-win_amd64.whl (180 kB)
---------------------------------------- 180.3/180.3 kB 1.5 MB/s eta 0:00:00
Installing collected packages: mysqlclient, mysql
Successfully installed mysql-0.0.3 mysqlclient-2.1.0
WARNING: There was an error checking the latest version of pip.
C:\Users\ADMIN\Desktop\SoftwareIndependent\myshop>mysql -h 127.0.0.1 -u root -p aimeos
'mysql' is not recognized as an internal or external command,
operable program or batch file.
How to Install MySQL on Windows10? | MySQL Tutorial for Beginners | MySQL Training
FYI in case someone needs this in the future:
https://www.youtube.com/watch?v=GIRcpjg-3Eg
Thanks!
-
- Posts: 7
- Joined: 03 Jun 2022, 17:50
Re: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
Any suggestion about those errors or am i moving in the right track by getting mysql installed?
Re: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
The "mysql" command is not necessary to be available. It was only a suggestion how you can test if the connection to the server works from the command line.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 7
- Joined: 03 Jun 2022, 17:50
Re: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
For those who needs it in the future.
Ok it seem like i didn't realized inputs i need for this portion so i needed to go back and change this based on what myphpadmin was telling me and the video provide the best example but it wasn't clear on the server setup but now everything is resolved.
https://www.youtube.com/watch?v=0FUEfM_divg
Portion in needed to fix in CMD.
Ok it seem like i didn't realized inputs i need for this portion so i needed to go back and change this based on what myphpadmin was telling me and the video provide the best example but it wasn't clear on the server setup but now everything is resolved.
https://www.youtube.com/watch?v=0FUEfM_divg
Portion in needed to fix in CMD.
Code: Select all
- DB_CONNECTION (mysql):
- DB_HOST (127.0.0.1):
- DB_PORT (3306):
- DB_DATABASE (laravel):
- DB_USERNAME (root):
- DB_PASSWORD: