azure mysql 配置,微软Azure云MySQL in-app 的配置,简化PHP内容管理系统配置
微軟 Azure 團隊早就為 Web 開發者推出了一項名為“MySQL in-app”的新功能,便于他們使用 Azure 應用服務(App Service)創建調用 MySQL 數據庫的 Web 應用。常見內容管理系統首先配置標準我們今天也給出:
WordPress 4+
Joomla 3+
Drupal 8+
Configuration Location
wwwroot/wp-config.php
wwwroot/configuration.php
wwwroot/sites/default/settings.php
Default Configuration
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘databaseName’);/** MySQL database username */
define(‘DB_USER’, ‘databaseUserName’);/** MySQL database password */
define(‘DB_PASSWORD’, ‘databasePassword’);/** MySQL hostname */
define(‘DB_HOST’, ‘databaseHostName’);
public $dbtype = ‘mysql’;
public $host = ‘databaseHostName’;
public $user = ‘databaseUserName’;
public $password = ‘databasePassword’;
public $db = ‘databaseName’;
public $dbprefix = ‘jos_’;
$databases[‘default’] [‘default’] = array (
‘database’ => ‘databasename’,
‘username’ => ‘sqlusername’,
‘password’ => ‘sqlpassword’,
‘host’ => ‘localhost’,
‘port’ => ‘3306’,
‘driver’ => ‘mysql’,
‘prefix’ => ”,
‘collation’ => ‘utf8mb4_general_ci’,);
MySQL In-App
Part 1 – Credentials
$connectstr_dbhost = ”;
$connectstr_dbname = ”;
$connectstr_dbusername = ”;
$connectstr_dbpassword = ”;foreach ($_SERVER as $key => $value) {
if (strpos($key, “MYSQLCONNSTR_localdb”) !== 0) {
continue;
}$connectstr_dbhost = preg_replace(“/^.*Data Source=(.+?);.*$/”, “\\1”, $value);
$connectstr_dbname = preg_replace(“/^.*Database=(.+?);.*$/”, “\\1”, $value);
$connectstr_dbusername = preg_replace(“/^.*User Id=(.+?);.*$/”, “\\1”, $value);
$connectstr_dbpassword = preg_replace(“/^.*Password=(.+?)$/”, “\\1”, $value);
}
WordPress 4+
Joomla 3+
Drupal 8+
MySQL In-App
Part 2 – Configuration
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, $connectstr_dbname);
/** MySQL database username */
define(‘DB_USER’, $connectstr_dbusername);
/** MySQL database password */
define(‘DB_PASSWORD’, $connectstr_dbpassword);
/** MySQL hostname : this contains the port number in this format host:port.
/** Port is not 3306 when using this feature*/
define(‘DB_HOST’, $connectstr_dbhost);
public $dbtype = ‘mysql’;
public $host = DB_HOST;
public $user = DB_USER;
public $password = DB_PASSWORD;
public $db = DB_NAME;
public $dbprefix = ‘jos_’;
$databases[‘default’] [‘default’] = array (
‘database’ => $connectstr_dbname,
‘username’ => $connectstr_dbusername,
‘password’ => $connectstr_dbpassword,
‘prefix’ => ”,
‘host’ => $connectstr_dbhost,
‘port’ => $_SERVER[‘WEBSITE_MYSQL_PORT’] ,
‘driver’ => ‘mysql’,
‘namespace’ => ‘Drupal\\Core\\Database\\Driver\\mysql’,
‘collation’ => ‘utf8mb4_general_ci’,
);
“MySQL in-app”允許開發者在相同環境中并行運行 MySQL 服務器與其 Web 應用,進而在開發并測試使用 MySQL 的 PHP 應用時起到簡化工作流程的效果。
MySQL 云數據庫服務已登陸 Azure 平臺,能夠提供高可靠、高安全、高可用、高性價比的數據庫,無需人工維護基礎架構,即可在云端快速部署,進而降低企業運維成本。
“MySQL in-app(預覽版)”功能簡介:
支持多款使用 MySQL 的 PHP 應用,如 WordPress(一種使用 PHP 語言開發的博客平臺)、Joomla(內容管理系統)與 Drupal(使用 PHP 語言編寫的開源內容管理框架)
節約開發成本:使用該功能無需支持額外費用,因為資源共享的緣故,您只需支付“應用服務(App Service)”計劃費用即可
MySQL 與 Web 進程能在相同環境下同時協作,進而實現存儲共享
支持慢速查詢日志與通用日志兩種模式,您可在需要時選擇打開相應模式即可(該功能會影響性能,請不要一直打開)
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的azure mysql 配置,微软Azure云MySQL in-app 的配置,简化PHP内容管理系统配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 下列关于php说法错误的,PHP试题
- 下一篇: 用matlab仿真函数在空间分布,1.3