3
votes
Accepted
How do I get connection to database by entering Database details in Magento 2?
You can use default Magento MysqlFactory this way (outside the magento):
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('memory_limit', '5G');
error_reporting(...
2
votes
Accepted
How to execute multiple DB queries?
Try something like this:
private ?AdapterInterface $connection = null;
private method doMultipleQueriesAndDoUnlockNoMatterWhat(): void
{
$query1 = sprintf('LOCK TABLE %s WRITE', $tablename);
$...
2
votes
Magento 2: installation command not working
Found Solution for issue db need to be clean using --cleanup-database attribute in installation command
php bin/magento setup:install --base-url=http://magento2.com/
--db-host=localhost --db-name=...
2
votes
DATABASE RELATED ERROR" SUCH AS SQLSTATE[HY000][2002]
You probably have wrong credential in your env.php for the database. Try to connect first to your database without magento.
1
vote
Accepted
Magento and MySQL: Access denied for user 'username'@'localhost' (using password: YES)
Maybe try to use
127.0.0.1
instead of
localhost
in app/etc/env.php
1
vote
How to properly replace database in Magento 2?
The following steps, you need to perform to properly replace the database:
Change connectivity parameters for the new database in app/etc/env.php
Check and correct base URLs in the core_config_data ...
1
vote
How do I get connection to database by entering Database details in Magento 2?
create a custom PHP script file in Magento setup root folder and from Magento "env.php" file you can get database details like this.
$env = require_once(__DIR__.'/app/etc/env.php');
$env = $env['db'][...
1
vote
How to create a complete group tab to admin?
try following way..
In file
app/code/local/Namesapce/Modulename/etc/system.xml
<general>
<groups>
<test translate="label">
&...
1
vote
Magento 2.2 - Fatal error: Uncaught Error: Call to undefined method Magento\Framework\App\ResourceConnection::load()
It looks like you are trying to do sql queries from within class. Need to do something like this
public function __construct(
\Magento\Framework\App\ResourceConnection $resource
)
{
$this-&...
1
vote
How to recover env.php file in Magento 2?
You need to find out about your hosting. If working on host might be worth reaching out to host to see if they have a restore procedure in place. The fact that you know what file and when you deleted ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
database-connection × 23magento2 × 15
database × 12
magento-1.9 × 2
magento2.3 × 2
php × 2
magento2.4 × 2
magento-2.1 × 1
magento2.2 × 1
adminhtml × 1
product-images × 1
configuration × 1
model × 1
installation × 1
migration × 1
magento-2.2.5 × 1
sales × 1
query × 1
data-migration × 1
resource-model × 1
script × 1
table × 1
magento-cron × 1
eav-attributes × 1
magento2.2.7 × 1