PDA

View Full Version : Database error on Ubuntu


Exeter
01-23-2014, 03:28 AM
I moved my board top an ubuntu vm to test a few features. Unfortunately vb fails to create a mysql connection.

mysqli_real_connect(): (HY000/2003): Can't connect to MySQL server on '127.0.0.1' (111)
/var/www/wwwroot/includes/class_core.php on line 1358

The username, password, and host appear to be correct. Connecting to the DB from a non-vb based PHP script works fine (using the same db users).

What could be causing this? Could I be missing packages or an environment configuration?

Thanks for your help

Brandon Sheley
01-23-2014, 05:14 AM
Make sure your config.php file is setup correcty.
It's not connecting to mysql.
What did you change inside that file?

This should help you troubleshoot
http://www.vbulletin.com/docs/html/cantconnect

Exeter
01-23-2014, 06:28 AM
The changes in the config are the obvious things. I traced the values the script uses on the line right before the error. Username, password, port, and db name are all correct.

I can connect just fine from a custom script run on the same server. All the connection tests I ran passed just fine. MySql is listening and the firewall is off.

RichieBoy67
01-23-2014, 04:03 PM
What do your mysql error logs have?

Exeter
01-23-2014, 10:47 PM
The mysql error log is empty.
As is the php log, because vb catches the error.

RichieBoy67
01-23-2014, 11:14 PM
I am talking about the logs in your servers var/log directory. They have nothing to do with the Vbulletin logs and they will show more details especially if you are having a server or my.cnf configuration issue.

Exeter
01-24-2014, 07:32 AM
Yes, those logs are empty.

--------------- Added 1390554864 at 1390554864 ---------------

Turns out the issue was the hostname.

127.0.0.1 (did not work)
localhost (works)

I don't know why yet.

Thanks everyone for your help.

RichieBoy67
01-24-2014, 02:04 PM
I was just going to post to check your config again. If your server log for mysql is empty then the problem lies in the config. it is tough to troubleshoot though without seeing what you have set there in the first place. Plus what confused me was when you said you used another script outside of Vbulletin. I just assumed it was using the same settings.

Oh well, all is well that ends well. Glad you have it figured out.