解決WordPress安裝錯誤“Error establishing a database connection”
在安裝完Mac上的xampp之后,啟動環(huán)境軟件并成功登錄phpmyadmin創(chuàng)建數(shù)據(jù)庫后,有些人可能會遇到在安裝和登錄WordPress時出現(xiàn)“Error establishing a databas
在安裝完Mac上的xampp之后,啟動環(huán)境軟件并成功登錄phpmyadmin創(chuàng)建數(shù)據(jù)庫后,有些人可能會遇到在安裝和登錄WordPress時出現(xiàn)“Error establishing a database connection”的問題。下面是解決這個問題的步驟。
步驟一:進入xampp文件夾
首先,打開你的xampp文件夾。你可以在啟動項中找到它,并點擊“Explore”。
步驟二:進入htdocs文件夾
在打開的窗口中,找到并點擊“htdocs”文件夾。
步驟三:進入wordpress文件夾
在“htdocs”文件夾中,找到并點擊“wordpress”文件夾。
步驟四:復制文件
在wordpress文件夾中,你會看到很多帶有“.php”后綴的文件。隨意選擇一個文件,比如“”,右鍵點擊并選擇復制。
步驟五:編輯文件
用記事本或者文本編輯器打開復制的“”文件,并將其中的內(nèi)容全部刪除。
然后,復制以下代碼并粘貼到剛才打開的文件中:
```php
/
* The base configuration for WordPress
*
* The creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "" and fill in the values.
*
* This file contains the following configurations:
*
* MySQL settings
*
* Secret keys
*
* Database table prefix
*
* ABSPATH
*
* @link _
*
* @package WordPress
*/
// MySQL settings - You can get this info from your web host //
/ The name of the database for WordPress */
define('DB_NAME', 'mysql');
/ MySQL database username */
define('DB_USER', 'root');
/ MySQL database password */
define('DB_PASSWORD', '');
/ MySQL hostname */
define('DB_HOST', 'localhost');
/ Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');
/ The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
/@
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', ' VbeFg`YABB_:olGY]gE:Ax/$9i`EOgG|WviTEh70d-n%V%ah*@jg`');
define('SECURE_AUTH_KEY', '04dmkzGF*RQMgt;{rX;DX}rhgt;N^*5}/OcRBampB?e.N$');
define('LOGGED_IN_KEY', '6@^e(a!~JQ:qhrIZF[fL (9)NK-MNAXxr9egt;w amp;B?e.N');
define('NONCE_KEY', 'reTiltW1uhz2GOj%Rlt; @J9]h-E0@[drW3EY`/.(lFTLo2l]Eja,sN| wsUS-xTE*');
define('AUTH_SALT', 's]bO^eO5 X(Dj/XT{XkfUS;b-_P7-5erUYuamp;)ELF2fK2wn-{wuY%wx[Qn%lDtPu');
define('SECURE_AUTH_SALT', 'OnLYvcFvR{gt;lt;`e(.FG9kPkK`;:lt;}4i9g7^)');
define('LOGGED_IN_SALT', 'oQ4Lh~ de_pblt;^,!pvt:2jmm!C|Zeq|j0U$wl22[cIVY956gt;p`(`.sgt;7.dHk9s|');
define('NONCE_SALT', ' oHHlSp7Orxxq^o? ^?/1ljZi^aoI@|J%? h0S%[aW6gt;cjJ%H}}/:NSmCOgt;gt;');
/@-*/
/
* WordPress Database Table prefix.
*
* You can have multiple installations in one database