Can't connect to MySQL! "Connection for controluser as defined in your configuration failed."

Posted February 20, 2014 47.2k views
I have a PHP application written with codeigniter that connects to MySQL just fine for two months. Yesterday, it couldn't connect to it, showing an error message that there was an error in the configuration or something! I did not change any settings at that time.. I tried to log in with phpmyadmin it told me this message "Connection for controluser as defined in your configuration failed". So, now I know that neither me nor the application can connect to the MySQL server. Restarted the droplet and everything got back to normal! Today, it did the same thing again -_-, just made a reboot and its fine again.. My question is: What is the real problem so I can prevent this from happening again? PS: I kinda noticed a new database now within MySQL i am not sure if it was "mysql" or "phpmyadmin" but i am sure they both were not in there.. I use the root username. Droplet runs Ubuntu. Thanks in advance..

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
7 answers
if you have configured MYsql correctly with its new pass, then you should be fine.

remember some security issues could block you from login such as iptables or fail2ban and so on...

make sure your firewall doesn't block mysql port 3306

you can always check your database after creating :
@FMCB there was no password change, I don't use iptables nor fail2ban.. Nothing was changed!
till now it didn't do it again so.. i dont know
Is MySQL running?
sudo netstat -plutn | grep 3306

I just encountered the same issue. No access to the MySQL server for any web requests including PHPMyAdmin with the error “Connection for controluser as defined in your configuration failed.” Rebooting the droplet fixed the error. badr.d, is this something that continued happening for you after the first two instances?

Also, i ran the code suggested by kamain7, and it appears the MySQL service was not running before I rebooted the droplet.

Running on Ubuntu 14.04

ihi, i have same problem. please help me

I am facing the same issue. After every few days, i see this error and i have to restart the droplet which resolves the issue. Need to know the root cause behind this.
Please help me.