-2

i tried to run http://127.0.0.1:8000/ in my browser, but i get this error message "SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it" im using laravel 9.5.1 and php 8.0.3. And when i run phpMyAdmin i get an error message "mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)"

i've tried to clear config and cache, edited file database.php, .env file and config.inc but it's still didn't work.

this is my database.php file

        'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '33060'),
            'database' => env('DB_DATABASE', 'myDatabaseName'),
            'username' => env('DB_USERNAME', 'root'),
            'password' => env('DB_PASSWORD', 'myPassword'),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8', 
            'collation' => 'utf8_unicode_ci', 
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

this is my .env file

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=33060
DB_DATABASE=myDatabaseName
DB_USERNAME='root'
DB_PASSWORD='myPassword'

and this is my config.inc file

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'myPassword';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

can someone please help me?, thank you

mimie
  • 17
  • 1
  • 5
  • And when you use said credentials outside of laravel, they work? – Stoff Apr 08 '22 at 15:45
  • Does this answer your question? [I can't access http://localhost/phpmyadmin/](https://stackoverflow.com/questions/10111455/i-cant-access-http-localhost-phpmyadmin) – Stoff Apr 08 '22 at 15:51
  • Are you sure that MySQL is running? – MANSOOR KOCHY Apr 08 '22 at 16:24
  • Ensure your WAMP Server (or XAMP) is working. And also check whether MySQL server is running or not. If you not run apache server(or any server you use) this could happen. After run your local server and refresh the page. – Anuj Chandel Apr 08 '22 at 16:41
  • yes mysql is running when i started in xampp. but i just realize when i try to change my password using command promt, i got error massage, it says "can't connect to MySQL server on 'localhost' (10061) check that mtsqld is running and that the socket: 'MySQL' exists!" i checked services.msc adn i can't found that mysql is running @Stoff – mimie Apr 09 '22 at 14:28
  • @MANSOORKOCHY in xampp running, but i'm not sure it's really running – mimie Apr 09 '22 at 14:32
  • @CodyBrew my answer is the same as before. have you ever had the same problem? if so, do you have a solution? thank you – mimie Apr 09 '22 at 14:35
  • @mimie yes, so many times on local server of office this is due to because server is not working. – Anuj Chandel Apr 09 '22 at 14:42

1 Answers1

-1
  • Can you log into your http://localhost/phpmyadmin/? (it your phpmyadmin in order?)

Your issues looks like your databases credentials aren't correct - it can't access your database

Check whether this helps: https://stackoverflow.com/questions/10111455/i-cant-access-http-localhost-phpmyadmin