Get and configure database information
When you install a web application on a web hosting instance, you need to configure its database connection. This topic uses WordPress and DedeCMS as examples to show how to obtain and configure the required information.
M-series M2 (Cloud) Web Hosting instances do not include a database. If you try to view database information for this type of instance, the fields are empty. If you need a database, we recommend purchasing one separately, such as an ApsaraDB for RDS instance, or upgrading to a web hosting instance that includes a database.
Procedure
- Obtain database information.
- Log on to the Cloud Web Hosting management page.
- Find the Cloud Web Hosting instance for which you want to obtain database information and click Manage in the Actions column.
- In the navigation pane on the left, click Database Information.
- On the Database Information page, obtain database information.
In the navigation pane on the left, click Database Information to view the Database name , Database version , Database address , Database username , and Data space usage. You can also perform operations such as Reset Password , Change Database , and Manage .Note If you forget your database password, reset it. For more information, see Reset the Cloud Web Hosting database password.
-
Configure the database information.
The following sections use the database configuration interfaces for WordPress and DedeCMS as examples.
NoteFor the complete installation steps for WordPress and DedeCMS, see Install a website on a Web Hosting instance and Install open source DedeCMS.
NoteIf you have recently migrated or changed your web hosting instance and want to verify that historical data was not lost, use the DMS feature in the console to check whether the data exists in the new instance's database. Also make sure that the database connection information in your website configuration file (such as
config_db.php) is updated to reflect the new instance's database details, to ensure your website continues to work correctly.-
WordPress
The following table describes the main parameters.
Parameter
Description
Database Name
Enter the database name. To obtain the name, see Step 1.
Username
Enter the database username. To obtain the username, see Step 1.
Password
Enter the database password. If you forget the password, you can reset it. For more information, see Reset the database password for a web hosting instance.
Database Host
Enter the database host. To obtain the host, see Step 1.
Table Prefix
Keep the default value
wp1_. If you plan to install multiple WordPress instances in the same database, modify the prefix. -
On the DedeCMS parameter configuration page, besides the database settings, you also need to configure the following: In the Module Selection area, select the modules to install, such as Guestbook and mobile WAP browsing. Set the Database Character Set to UTF8. In the Initial Administrator Password area, set the administrator username (the default is admin) and password. In the Website Settings area, enter the website name, administrator email address, and website URL. When you are finished, click Continue.
The following table describes the main parameters.
Parameter
Description
Database Type
Keep the default value
MySQL.Database Host
Enter the database host. To obtain the host, see Step 1.
Database User
Enter the database username. To obtain the username, see Step 1.
Database Password
Enter the database password. If you forget the password, you can reset it. For more information, see Reset the database password for a web hosting instance.
Data Table Prefix
Keep the default value
dede_. Only change this parameter if your setup requires it.Database Name
Enter the database name. To obtain the name, see Step 1.
-
FAQ
Why can't I connect to the web hosting database?
If you fail to connect to the database on your web hosting instance, troubleshoot the issue based on the following scenarios:
-
Wrong password: The most common cause of connection failure is an incorrect password. Log on to the Cloud Web Hosting console to reset the database password, and then try again.
-
SQL Server remote connection restriction: The SQL Server database on a web hosting instance only supports internal connections within the same instance, for example, using
.\\sqlexpressor a specific instance name. Remote connections from a local computer or external network are not supported. To manage the database, use the DMS (Data Management Service) feature provided in the console. -
Client tool configuration issue: If a third-party database client fails to connect, the issue may be caused by incorrect tool configuration or network settings. Make sure the tool is configured with the correct database address, username, and password as displayed in the console. We recommend using the web-based DMS as a replacement for deprecated local client tools.
-
Website program connection error: If your website returns an error but a direct connection test from the console succeeds, check whether the database connection information in your website configuration file is consistent with the current host. If necessary, back up your data and then reconfigure the connection settings.
Does web hosting support creating multiple databases?
Web hosting instances do not support creating multiple database instances or adding new database users. The console does not provide an option to create additional databases. The database name, username, and other connection details in your configuration file must exactly match the information displayed in the console. You cannot use custom database names or usernames.
If you need to segregate data for different business modules, create different table name prefixes within the same database — for example, user_ and order_ — to achieve logical isolation.
Why can I not log in after directly modifying the WordPress password field in the database?
WordPress stores passwords in a hashed format. Writing a plain-text password directly into the database will not work. The correct approach is: in your database management tool (such as DMS), change the wp_users table's user_pass field for the target user to MD5('new_password') (using the MySQL MD5 function). After the modification, you can log in with the new password, and WordPress will automatically upgrade the password to a more secure hash format.
Writing a plain-text password (such as 123456) directly into the field will not work. You must use the MD5 function to wrap the password value.