TYPO3: Access denied to database after moving installation - exception

I have migrated successfully my TYPO3 v10 site under mampp. Now I get this exception:
Doctrine\DBAL\Exception\ConnectionException An exception occurred in driver: Access denied for user 'dbxx'#'localhost'
My configuration entry is the following:
'DB' => [
'Connections' => [
'Default' => [
'charset' => 'utf8mb4',
'dbname' => 'mysite_f10',
'driver' => 'mysqli',
'host' => 'localhost',
'password' => 'root',
'tableoptions' => [
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_unicode_ci',
],
'user' => 'root',
],
],
],
Is it possible, that TYPO3 stores still my old database values in a cache? And if, how can I clear my cache manually?

Database credentials are not cached anywhere. I assume that you changed the values in LocalConfiguration.php. You should check your installation if there is a file called AdditionalConfiguration.php in the same directory as LocalConfiguration.php. All values in that file overwrite values from LocalConfiguration.php.

Related

Yii2 Read Write splitting couldn't connect slave server in master slave configuration

Have done Master Slave configuration as per official Yii2 documentation. Below is actual configuration look like,
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=1.1.1.1;dbname=master_db',
'username' => 'user',
'password' => 'password',
'charset' => 'utf8',
'enableSchemaCache' => true,
'schemaCacheDuration' => 10,
'schemaCache' => 'cache',
'slaveConfig' => [
'username' => 'slave_user',
'password' => 'slave_password',
'charset' => 'utf8',
'attributes' => [
// use a smaller connection timeout
PDO::ATTR_TIMEOUT => 10,
],
'enableSchemaCache' => true,
'schemaCacheDuration' => 10,
'schemaCache' => 'cache',
],
'slaves' => [
['dsn' => 'mysql:host=2.2.2.2;dbname=slave_db']
],
],
It always connect master database even if slave server is up and reachable.
Surprisingly replacing current master config with slave one works, moreover if try to connect slave database from command line it get connected in a moment but unable to achieve same with above configuration.
Wondering if there is any parameters missing in configuration or any other way to get things working like ideal read write splitting?
issue was resolved by adding connection class in the slaveConfig,
'class' => 'yii\db\Connection'

Laravel 5 and remote mysql not working on production

In my local environment I have working a secondary remote mysql connection specified in config/database.php without any problems:
# Secondary database connection
'mysql_remote' => [
'driver' => 'mysql',
'host' => env('DB_HOST_2', 'cherokee.websitewelcome.com'),
'port' => env('DB_PORT_2', '3306'),
'database' => env('DB_DATABASE_2', 'dbname'),
'username' => env('DB_USERNAME_2', 'dbusr'),
'password' => env('DB_PASSWORD_2', 'dbpass'),
'unix_socket' => env('DB_SOCKET_2', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
But when I run this on production server with the exact same database file I get the following error, is like the remote host (cherokee.websitewelcome.com) is not used and replace it with local server host (eu01.server.plus)
SQLSTATE[HY000] [1045] Access denied for user 'dbusr'#'eu01.server.plus' (using password: YES) (SQL: select ...)
Any ideas?
Solved by adding eu01.server.plus to authorized hosts on remote mysql server. Initially I was adding the IP and not hostname.

Master Slave Configuration in Laravel 5.5

How to configure Laravel 5.5 with master slave MySQL replication ?
I want to make write operations and read operations in master and slave respectively .
Optional: Is there any way to do connection pooling and max / min no of open connections in ideal conditions. ?
Just change your config/database.php file to include read (slave) and write (master) hosts like so like the Laravel docs suggest:
'mysql' => [
'read' => [
'host' => '192.168.1.1',
],
'write' => [
'host' => '196.168.1.2'
],
'sticky' => true,
'driver' => 'mysql',
'database' => 'database',
'username' => 'root',
'password' => '',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
],

Multiple database connection failed, PDOException in Connector.php line 47 SQLSTATE[HY000] [2002] A connection attempt failed

I am trying to connect remote database from my localhost, the cause of I want to store data localhost to remote server. Now I want to show simply users table info it get form my localhost and different variable show remote server users table info . I write the code example here :
In my Config/database.php:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'realstate'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
'shahin' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '104.219.248.3'),
'database' => env('DB_DATABASE', 'laraveldb'),
'username' => env('DB_USERNAME', 'laraveldb_username'),
'password' => env('DB_PASSWORD', 'secret'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
In Route.php :
Route::get('mpdb',function(){
$userArray = DB::table('users')->get();
echo "<pre>";
print_r($userArray);
echo "</pre><br>";
$users2 = DB::connection('shahin');
$u = $users2->table('users')->get();
echo "<pre>";
print_r($u);
});
Local Database work's properly but Remote database get error!!
ERROR : SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
To allow external web servers to access your MySQL databases, add their domain names to the list of hosts that are able to access databases on your web site.
see a hosted cpanel demo(Image)
If you want to all incoming hosts you may access like this %.%.%.%
You can see this picture
How to permit other incoming host(Image)

Resolving database connectivity issues on Forge

When I try to login to the app I have setup on Forge, my Laravel app spits out this error:
SQLSTATE[HY000] [1045] Access denied for user 'appname'#'localhost' (using password: YES)
I have the environment variables configured correctly and they work fine on my copy of the site on my local Homestead vagrant box.
Here is the .env.php file that Forge wrote:
return [
'APP_ENV' => 'production',
'DB_DRIVER' => 'mysql',
'DB_HOST' => 'localhost',
'DB_NAME' => 'appname',
'DB_USER' => 'appname',
'DB_PASS' => 'LoNgPaSsWoRd',
];
Here is the relevant contents of app/config/database.php which works locally:
'default' => getenv('DB_DRIVER'),
'connections' => array(
'mysql' => array(
'driver' => getenv('DB_DRIVER'),
'host' => getenv('DB_HOST'),
'database' => getenv('DB_NAME'),
'username' => getenv('DB_USER'),
'password' => getenv('DB_PASS'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
),
I tried dumping the environment values before the first database connection is accessed using dd(getenv('DB_PASS'), getenv('DB_USER')) and they show up correct.
I also tried connecting through MySQL Workbench and resetting the password to exactly what is shown in the environment variable Forge wrote.
None of my other subdomains are having this issue.
What could be going on here and how could I debug this?