Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vishalpardeshi's avatar

Access denied for user 'root'@'localhost' (using password: NO)

Access denied for user 'root'@'localhost' (using password: NO) (SQL: sel ect * from information_schema.tables where table_schema = demoadmin and table_name = menus) on hosting godaddy

0 likes
22 replies
xopa's avatar

You're not going to have root access on shared hosting with GoDaddy. If you check in your control panel you should be able to view the database username / password or set a new one.

Once this is done update the .env file in your project root with these details.

vishalpardeshi's avatar

@xopa i have Copied my project and created new password and updated the .env file as well same problem occurs

ImeDa's avatar

It seems u have incorrect values in .env file for database connection. DB_HOST seems to be okay. Check DB_USERNAME and DB_PASSWORD.

Or maybe ur not using .env variables at all. Check config/database.php file. Do u have something like this:


        'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ],

Or have some hard coded values like:

'username' => 'forge'
vishalpardeshi's avatar

@ImeDa

i have done .env

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=ecube_v2
DB_USERNAME=ecube_db
DB_PASSWORD=03OalxShHVWx

config file

 'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'ecube_v2'),
            'username' => env('DB_USERNAME', 'ecube_db'),
            'password' => env('DB_PASSWORD', '03OalxShHVWx'),
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ],

but when i create a new application throught SSH It works properly, and not with my copied project

and after updated the thing it shows sel ect * from information_schema.tables where table_schema = demoadmin and table_name = menus) on

where demoadmin not there on cpanel its my localmachine database name

ImeDa's avatar

U say

DB_DATABASE=ecube_v2
DB_USERNAME=ecube_db

Why DB_USERNAME is called ecube_db and DB_DATABASE is called ecube_v2. Is it really correct ? Seems like DB_USERNAME should be ecube_db.

vishalpardeshi's avatar

@ImeDa

no ihave created the new database with

databasename ecubedb

username ecubev2

'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'ecubedb'),
            'username' => env('DB_USERNAME', 'ecubev2'),
            'password' => env('DB_PASSWORD', 'mypassword_here'),
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ],


.env file

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=ecubedb
DB_USERNAME=ecubev2
DB_PASSWORD=mypassword_here

In ssh Terminal error

 [Illuminate\Database\QueryException]
  SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: sel
  ect * from information_schema.tables where table_schema = demoadmin and table_name = menus)
ImeDa's avatar

Maybe ur application is using .env.example file, not .env. I know it would not display errors, but still an option.

ImeDa's avatar

Also try this:

php artisan config:clear

It will clear configuration cache file.

vishalpardeshi's avatar

mysql -u root -p this is also not working in ssh panel

it gives error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

ImeDa's avatar

try:

mysql -u ecubev2 -p your_password
vishalpardeshi's avatar

does there any steps tutorial to configure laravel application on hosting

ImeDa's avatar

Try reloading ur web server. It may help.

Abi's avatar

on a shared server you won't have access to root. you need to create a new database and a user for it. you also need to check the host of the database sometime is not located in localhost. they should give you the info when you create a new database.

jlrdw's avatar

I have a laravel site working fine on GoDaddy just hard code config and don't use the environment file.

vishalpardeshi's avatar
vishalpardeshi
OP
Best Answer
Level 1

i have solved the issue . the problem was about the clear the laravel application configration on localsystem and the upload the apllication on the hosting. by doing this on localsystem first

 php artisan config:clear

the worked for me thank you:)@ImeDa

3 likes
BenjaBoy7's avatar

Try to use username and password as follows with quotation. i have no idea how it worked, but it really worked for me after searching a lot.

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=admin_clrank DB_USERNAME='admin_clranke' DB_PASSWORD='admin@123'

Please or to participate in this conversation.