What is the Issue?
Website is showing error establishing database connection in the browser. This means that for some reason your php source code is not able to connect your mysql database, to retrieve the informations which needs to be be placed on your host web page. When the web host fails to connect to the database it will be left with lots of prime functionalities while connecting to your server and the database, that causes this error. repairing the website could resolve this website.If you are having the dynamic web pages rather than static web pages on HostingRaja VPS or Cloud server then you need to proceed next steps which we have mentioned below.

Why has this issue occurred?
Cloud computing has become one of the mostly used phenomenon in today’s world. As it must be known that each type of technology has its own limitations so does the cloud have. Most number of issues starts when the user loses control over the data. This problem or issues may be due to any one of the following problem with HostingRaja VPS or cloud. With the cloud losses of resources are rare as the infrastructure is designed to feed the immediate resource when one of them collapses. So it can be a reliable decision of opting the cloud server. Incorrect Database Credentials: If database is created with appropriate username and password under HR Panel Mysql Module Then you need to check whether same login credentials are given under your database configuration file which you have placed under public_html. If no database is created and you are placed incorrect database connection details on your configuration file will results in connectivity error.

Database got corrupted: If your database got corrupted you are not able to perform any functions like displaying dynamic data’s, insertions of data’s and so on. Database Corruption will be due to the following Reasons:

a) It might be beause of Improper shutdown of MySQL server due to power outage.
b) If have used “killall -9 mysqld” command to shut down the server and killing all ongoing mysql processes.
c) MySQL Services might have got stopped due to high load in the server or RAM usage exceeded its limit.
d) If you are having a large amount of data’s in your database. So in that case you should make sure that there is enough disk space to store the data in advance.


How can we prevent it?
Follow any one of the following steps to prevent from the problem which is mentioned above:

1. You need to check whether you have written proper database connection credentials under database configuration file. If you found no data or improper database name,username and password then you need to check the proper details from HR Panel mysql database modules and update it on your source code.
Web Hosting
at a very Affordable Price
Starts at Rs. 69
VPS Hosting
VPS Hosting
Customized for all technologies
Starts at Rs. 732
Cloud Hosting
Cloud Hosting
Security & Performance Guaranteed
Starts at Rs. 2680
Windows Hosting
Windows Hosting
Reliable Windows Plans
Starts at Rs. 199
Dedicated Hosting
Fully managed Servers in India
Starts at Rs. 4499
Linux Hosting
Linux Hosting
Reliable Linux plans
Starts at Rs. 69
For Example,
If you are using wordpress then you need to write database configuration details under wp-config.php

Refer this example were you need to add the database complete details and Security keys:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );


define('AUTH_KEY',         'i)K|09Pd+(2ZzEnyP$},QFQod7MIQ6Ti7Mk%=s8]i-+jV|`87,^Zm @zy_ENY%!d');
define('SECURE_AUTH_KEY',  'U5p4K1V@ORg @iB:HeSJ!-Nn=*uZ^}^efE|QojGxA)B+_.>fD,1G$q?-C;$Vevx.');
define('LOGGED_IN_KEY',    '@k(^y#UBhRh]`#xXcgv?|Ka?8e.E|F++[P!{0J<<J<hCkHD`%={Yl2?dHDHRn-qh');
define('NONCE_KEY',        '-)kwh;dV|>ao6XjBkyTGZCi{y=Ceg8d]fOsFLRlKBL]R:BxZGu*&F-tSXx CxzF8');
define('AUTH_SALT',        'B+CO319 ccfyEtjIJ%r0eD0@_=nJ*,l/n9mC*T`6P`#YT+%{y-?$8}v!Z7,+aI!,');
define('SECURE_AUTH_SALT', ';QytL5H$&A7F(Sj`V!W,AK-LK*BK|6NO1rt($.Iq&Q`Wd?a/;;@H9}RNLVEbrriK');
define('LOGGED_IN_SALT',   'sZ:g6w@V;^^i43bCK?um+Nrq,e:e6;#S#$!-}`6X %_~xKFqh,G*}1zfN3f1|8!n');
define('NONCE_SALT',       '8V-e8=&?[bc9>(l(xE|ge]__Re(,ip~WoO,f.YyX!p|Gu%8`+Pm.p=-`MKww,cra');


2. If you have written proper database connectivity details like database name, username, password but still you are facing connectivity issue then you need to check whether mysql services status by using the command:

service mysqld status

To restart the mysql services use this command:

service mysqld restart

Check whether database got corrupted or not using the command:
mysqlcheck --repair --all-databases

If database cannot get repaired you need to upload the previous backup of databases.

Next Step you need to optimize your mysql for faster response so that you can reduce too many connections and reduce RAM usage.

Use HostingRaja Mysql Optimisation Code :

You need to add these lines on your my.cnf file.

vim /etc/my.cnf

Remove all the lines above [mysqld_safe] and enter the below lines:

query_cache_size = 64M
query_cache_limit = 2M
join_buffer_size = 8M
tmp_table_size = 512M
key_buffer = 32M
innodb_buffer_pool_size = 1024M
innodb_thread_concurrency = 2
max_allowed_packet=268435456
max_user_connections=100
max_connections = 251
read_buffer_size = 2M
open_files_limit=50000
innodb_log_file_size=256M
interactive_timeout=180
wait_timeout=180