Connection to the MySQL Database

Working MySQL database by purpose, it needs a script, which will call or query the database for necessary stored information. In this case you should connect the script in the database by a configuration file. If you don’t know where this file is located, please look at lists with different scripts to find it.

Settings of the Configuration

Scripts like Wordpress, WHMCS and Joomla are examples for database driven scripts and they usually have a default configuration file, which is ready for edit. Here is anexample, showing how will look like access information:

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


WordPress Example

Username = mike1337

Database Name = wrdp1

Database-Username = wp1

Database-User Password = eHTb7%Pxa9



// ** MySQL Settings ** //
/** The name of the database for WordPress */
define('DB_NAME', '
mike1337_wrdp1');

/** MySQL database username */
define('DB_USER', '
mike1337_wp1');

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

/** MySQL hostname */
define('DB_HOST', 'localhost');

We do not recommendconnection to the database by your cPanel username and password.

Some tips how to move Databases

  • If you move databases from servers, its name and username could change. Don’t forget to update this change in your script code. (You will find the database name and username in cPanel, then the MySQL).
  • Please note: If you use shared servers, you can change the database username only if the new name contains the cPanel username in it. This is due to avoiding username conflicts with others on the server.
MySQL User Has NoPrivileges

There are random bugs with the 11.25 update. Adding of IP to the MySQL access list leads to no privileges for the MySQL user.

If you want to get the correct privileges follow these steps:

1. Go to MySQL Databases in cPanel.
2. Re-add the user to each database.To do this select the user and the database from the drop-down menus.
3. Reassign all privileges.
4. Click Add.

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

reCapcha doesn't work on my WordPress site. How to fix it?

Question: I have some issues with my reCapcha on my WordPress site, how to fix it. It was just...

Is it possible to get a dedicated IP address for my webpage?

Question: Hello, Is it possible to get a dedicated IP address for my webpage? (I am planning to...

Problem with PHP WordPress memory

Question: I'm trying to increase the php memory limit to 128Mb in order to keep Woocommerce...

Ad banner module does not work in my host

Question: I installed an ad banner module, but gave me the following message:ForbiddenAccess to...

I can't access to my WP installation

Question: After copying the new site files to de main directory, I can not login into my...