Closed RazaGR closed 3 years ago
Can you provide more details? Such as CI4 version, configuration details, DB, the error message you're getting and other useful information. With just the information you've provided it does not appear to be a bug.
Can you provide more details? Such as CI4 version, configuration details, DB, the error message you're getting and other useful information. With just the information you've provided it does not appear to be a bug.
This is fresh installed with composer. I have tried on a Mac and Ubuntu server.
Error:
CodeIgniter\Database\Exceptions\DatabaseException Unable to connect to the database. Main connection [MySQLi]: Access denied for user '****'@'localhost' Using Password (YES)
The solution I tried:
Below details from Mac:
php -v
PHP 7.4.19 (cli) (built: May 13 2021 06:28:47) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
composer.json:
{
"name": "codeigniter4/appstarter",
"type": "project",
"description": "CodeIgniter4 starter app",
"homepage": "https://codeigniter.com",
"license": "MIT",
"require": {
"php": "^7.3||^8.0",
"codeigniter4/framework": "^4",
"benedmunds/codeigniter-ion-auth": "4.x-dev",
},
"require-dev": {
"fakerphp/faker": "^1.9",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^9.1",
},
"suggest": {
"ext-fileinfo": "Improves mime type detection for files"
},
"autoload": {
"psr-4": {
"App\\": "app",
"Config\\": "app/Config"
},
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\Support\\": "tests/_support"
}
},
"scripts": {
"test": "phpunit"
},
"support": {
"forum": "http://forum.codeigniter.com/",
"source": "https://github.com/codeigniter4/CodeIgniter4",
"slack": "https://codeigniterchat.slack.com"
},
"minimum-stability": "dev",
"repositories": {
"ionAuth": {
"type": "vcs",
"url": "git@github.com:benedmunds/CodeIgniter-Ion-Auth.git"
}
}
}
nginx -V
nginx version: nginx/1.19.9
built by clang 12.0.0 (clang-1200.0.32.29)
built with OpenSSL 1.1.1k 25 Mar 2021
TLS SNI support enabled
configure arguments: --prefix=/usr/local/Cellar/nginx/1.19.9 --sbin-path=/usr/local/Cellar/nginx/1.19.9/bin/nginx --with-cc-opt='-I/usr/local/opt/pcre/include -I/usr/local/opt/openssl@1.1/include' --with-ld-opt='-L/usr/local/opt/pcre/lib -L/usr/local/opt/openssl@1.1/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --with-compat --with-debug --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-ipv6 --with-mail --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module
mysql -V
mysql Ver 15.1 Distrib 10.5.9-MariaDB, for osx10.16 (x86_64) using readline 5.1
Two options. Either your MySQL is using the non-default port or you're also using .env
file and forgot to change some settings there. There is no possibility that simply changing the group name with the same credentials inside the config array will work in one case and in another not.
I was not able to connect with database , regardless whatever I tried by finding on forums, then out of blue I changed #defaultGroup value in Database.php to some other and it worked.
SO I changed this:
To
ant it was working fine.