DigitalBerg
  • HOME
  • WINDOWS VPS
  • VIRTUAL SERVER
    • Virtuozzo VPS
    • OpenStack VPS
    • Amazon Lightsail VPS
    • VMware VPS
  • DEDICATED SERVER
    • INSTAND DEDICATED SERVERS
    • HOSTING DEDICATED SERVERS
    • DEDICATED ENTERPRISE SERVERS
    • INFRA. DEDICATED SERVERS
    • DEDICATED GAME SERVERS
  • MORE
    • SSL SHOP
    • FREE SSD WEBHOSTING
  • LOGIN
  • Click to open the search input field Click to open the search input field Search
  • Menu Menu

We talking about Cloud

Web Hosting & Cloud Services
Celebrate the power and freedom of Open Source
with Open Source Cloud Servers starting at only £10/mo £5/mo.

How to Connect to the MySQL Database

A script contacting or querying the database for the information it stores is required for your MySQL database to function properly. To do so, you’ll need to use a configuration file to connect your script to the database.
If you’re not sure where your configuration file is, look through this list of scripts to locate it:
  • Location of Script Configuration Files

Configuration Settings

Database-driven software like WordPress, WHMCS, and Joomla will usually come with a default configuration file that you may change with the necessary information.

Examples of how this access information will appear are shown below:

Host Name = localhost (literally input localhost)
Database Name = cpanelUsername_databaseName
Database Username = cpanelUsername_databaseUsername
Database Password = whatever you selected

WordPress Example

Username = joe1337 Database Name = wrdp1
Database-Username = wp1 Database-User Password = eHTb7%Pxa9

// ** MySQL Settings ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘joe1337_wrdp1’);

/** MySQL database username */
define(‘DB_USER’, ‘joe1337_wp1’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘eHTb7%Pxa9’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

While connecting to the database with your cPanel username and password is feasible, we DO NOT advocate it. Your databases will cease working if you change or reset your cPanel password before updating the configuration files.

Please read: Remote MySQL Connection to understand how to connect to the MySQL server.

  • How to Connect to MySQL Remotely

Tips and Tricks for Moving Databases

  • The database name and login may change when you move databases to our servers. This change must be reflected in the code of your script.  (In the MySQL part of cPanel, the database name and username are plainly shown.)
  • On shared servers hosting, you can’t change the database username without also changing the cPanel username. This prevents database names and usernames from clashing with those of other users on the server.

MySQL User Has No Privileges

We’ve found an odd error with the 11.25 release in which adding an IP to the MySQL remote access list results in the accompanying MySQL user having no rights.

To add the appropriate privileges, follow these steps:

  1. Go to your MySQL Databases in cPanel.
  2. Select the user and the database from the drop-down menus to re-add the user to each database.
  3. Reassign the privileges.
  4. Click Add.

We’ve alerted cPanel about the problem in the hopes that it will be fixed in future versions.

Get in Touch

Let me know if you got an interesting project and want to work together!

digitalberg.com

DigitalBerg fuels apps, websites, emails, and much more for numerous clients globally.

Virtual servers to dedicated servers at affordable prices that any hostinger student can afford.

Services

  • Web Hosting
  • Virtual Server
  • Instant Servers
  • Dedicated Servers
  • Enterprise Servers
  • Infrastructure Servers
  • Gaming Servers
  • SSL Shop

SUPPORT

  • Contact Us
  • Wiki
  • FAQ
  • Blogs

Company

  • About Us
  • Partners
  • Privacy Policy
  • Term of Service
  • Acceptable Use Policy
  • Green Hosting
  • Data center

CLIENT AREA

  • Registration
  • Client Area
  • Server Status
  • Support

OTHER SERVICES

  • Domain Registration
  • Transfer Domain
  • Add ons / Management
  • SSL Certificates
  • Server Monitoring
  • Server hardware
DigitalBerg review
DigitalBerg review
© Copyright - DigitalBerg | From January 1st 2015, in accordance with the amended Directive 2006/112/EC, prices inclusive of VAT may vary depending on the country of residence of the customer.
  • Link to Facebook
  • Link to X
  • Link to LinkedIn
Link to: Custom error pages Link to: Custom error pages Custom error pages Link to: Location of Script Configuration Files Link to: Location of Script Configuration Files Location of Script Configuration Files
Scroll to top Scroll to top Scroll to top