Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cract cms can't connection Azure mysql #6436

Closed
hiake21c opened this issue Jul 22, 2020 · 1 comment
Closed

Cract cms can't connection Azure mysql #6436

hiake21c opened this issue Jul 22, 2020 · 1 comment
Assignees
Labels

Comments

@hiake21c
Copy link

hiake21c commented Jul 22, 2020

### Description

In Azure Mysql, username must include "@".
If it set Azure Msql in Craftcms, username will be cut off after "@".
And than, if it enter the database host (domain) of Azure Mysql, it converts to ip by Craftcms and tries to connect.
Azure SQL cannot be accessed by ip.
it must used domain name where connect to Azure data base.

Steps to reproduce

  1. Make Azure mysql
  2. set mysql to craftCMS

DB_SERVER='users_info.mysql.database.azure.com'
DB_USER='your_username@yours_username'

Additional info

  • Craft version: 3.0
  • PHP version: 7.0
  • Database driver & version: mysql 5.6
  • Plugins & versions:

I added my log

2020-07-22 21:32:33 [-][-][-][info][yii\db\Connection::open] Opening DB connection: mysql:host=test.mysql.database.azure.com;dbname=tera_craftcms_edge;port=3306
2020-07-22 21:32:33 [-][-][-][profile begin][yii\db\Connection::open] Opening DB connection: mysql:host=test.mysql.database.azure.com;dbname=tera_craftcms_edge;port=3306
2020-07-22 21:32:33 [-][-][-][profile end][yii\db\Connection::open] Opening DB connection: mysql:host=test.mysql.database.azure.com;dbname=tera_craftcms_edge;port=3306
2020-07-22 21:32:33 [-][-][-][error][craft\db\Connection::open] SQLSTATE[HY000] [1045] Access denied for user 'test_site_user'@'157.55.174.73' (using password: YES)
2020-07-22 21:32:33 [-][-][-][error][craft\db\Connection::open] SQLSTATE[HY000] [1045] Access denied for user 'test_site_user'@'157.55.174.73' (using password: YES)
2020-07-22 21:32:33 [-][-][-][error][craft\base\ApplicationTrait::getIsDbConnectionValid] There was a problem connecting to the database: Craft CMS can’t connect to the database with the credentials in config/db.php.
2020-07-22 21:32:33 [-][-][-][error][craft\errors\DbConnectException] PDOException: SQLSTATE[HY000] [1045] Access denied for user 'test_site_user'@'157.55.174.73' (using password: YES) in /var/shared/www/vendor/yiisoft/yii2/db/Connection.php:703
Stack trace:
#0 /var/shared/www/vendor/yiisoft/yii2/db/Connection.php(703): PDO->__construct()
#1 /var/shared/www/vendor/yiisoft/yii2/db/Connection.php(624): yii\db\Connection->createPdoInstance()
#2 /var/shared/www/vendor/craftcms/cms/src/db/Connection.php(150): yii\db\Connection->open()
#3 /var/shared/www/vendor/craftcms/cms/src/base/ApplicationTrait.php(799): craft\db\Connection->open()
#4 /var/shared/www/vendor/craftcms/cms/src/base/ApplicationTrait.php(281): craft\web\Application->getIsDbConnectionValid()
#5 /var/shared/www/vendor/craftcms/cms/src/services/Sites.php(1138): craft\web\Application->getIsInstalled()
#6 /var/shared/www/vendor/craftcms/cms/src/services/Sites.php(448): craft\services\Sites->_loadAllSites()
#7 /var/shared/www/vendor/yiisoft/yii2/base/Component.php(180): craft\services\Sites->setCurrentSite()
#8 /var/shared/www/vendor/yiisoft/yii2/BaseYii.php(558): yii\base\Component->__set()
#9 /var/shared/www/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure()
#10 [internal function]: yii\base\BaseObject->__construct()
#11 /var/shared/www/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs()
#12 /var/shared/www/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build()
#13 /var/shared/www/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get()
#14 /var/shared/www/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject()
#15 /var/shared/www/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get()
#16 /var/shared/www/vendor/craftcms/cms/src/web/Application.php(341): yii\base\Module->get()
#17 /var/shared/www/vendor/craftcms/cms/src/base/ApplicationTrait.php(1238): craft\web\Application->get()
#18 /var/shared/www/vendor/craftcms/cms/src/web/Request.php(185): craft\web\Application->getSites()
#19 /var/shared/www/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Request->init()
#20 [internal function]: yii\base\BaseObject->__construct()
#21 /var/shared/www/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs()
#22 /var/shared/www/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build()
#23 /var/shared/www/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get()
#24 /var/shared/www/vendor/craftcms/cms/src/config/app.web.php(13): yii\BaseYii::createObject()
#25 [internal function]: {closure}()
#26 /var/shared/www/vendor/yiisoft/yii2/di/Container.php(524): call_user_func_array()
#27 /var/shared/www/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->invoke()
#28 /var/shared/www/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject()
#29 /var/shared/www/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get()
#30 /var/shared/www/vendor/craftcms/cms/src/web/Application.php(341): yii\base\Module->get()
#31 /var/shared/www/vendor/yiisoft/yii2/web/Application.php(160): craft\web\Application->get()
#32 /var/shared/www/vendor/craftcms/cms/src/base/ApplicationTrait.php(1380): yii\web\Application->getRequest()
#33 /var/shared/www/vendor/craftcms/cms/src/web/Application.php(100): craft\web\Application->_preInit()
#34 /var/shared/www/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()
#35 /var/shared/www/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct()
#36 /var/shared/www/vendor/craftcms/cms/src/web/Application.php(91): yii\base\Application->__construct()
#37 [internal function]: craft\web\Application->__construct()
#38 /var/shared/www/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs()
#39 /var/shared/www/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build()
#40 /var/shared/www/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get()
#41 /var/shared/www/vendor/craftcms/cms/bootstrap/bootstrap.php(245): yii\BaseYii::createObject()
#42 /var/shared/www/vendor/craftcms/cms/bootstrap/web.php(51): require('/var/shared/www...')
#43 /var/shared/www/web/index.php(20): require('/var/shared/www...')
#44 {main}
@hiake21c hiake21c added the bug label Jul 22, 2020
@angrybrad angrybrad self-assigned this Jul 23, 2020
@hiake21c
Copy link
Author

I sovled this issue.

I can connect Azure mysql now after that I delete runtime directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants