Strange database connection problem
Permalink
Hi there,
I'm putting concrete5 on a live server after running it locally and coming up against the 'Unable to connect to database' message on the install page.
I can connect to mysql via the command line so initially I thought it was a php config problem. I wrote a php script however to test the database connection which connected without any problem.
I've created a mysql user with all the correct permissions. I've got other sites on the same server using mysql without any issues.
I'm convinced that my username, password and database name are correct because the php test script establishes a connection using the same details.
I've tried all the following hostnames for the concrete5 install without any success:
localhost
localhost:3306
127.0.0.1
127.0.0.1:3306
:/var/run/mysqld/mysqld.sock
localhost:/var/run/mysqld/mysqld.sock
Like I said this all works no problem with my test script. But concrete5 just doesn't seem to want to connect to the database.
Any suggestions appreciated. I'm running short on ideas.
I'm putting concrete5 on a live server after running it locally and coming up against the 'Unable to connect to database' message on the install page.
I can connect to mysql via the command line so initially I thought it was a php config problem. I wrote a php script however to test the database connection which connected without any problem.
I've created a mysql user with all the correct permissions. I've got other sites on the same server using mysql without any issues.
I'm convinced that my username, password and database name are correct because the php test script establishes a connection using the same details.
I've tried all the following hostnames for the concrete5 install without any success:
localhost
localhost:3306
127.0.0.1
127.0.0.1:3306
:/var/run/mysqld/mysqld.sock
localhost:/var/run/mysqld/mysqld.sock
Like I said this all works no problem with my test script. But concrete5 just doesn't seem to want to connect to the database.
Any suggestions appreciated. I'm running short on ideas.
If you have special characters such as /:?_ in your dsn, then you need to rawurlencode them first:
$dsn2=rawurlencode("sybase_ase")."://user:pass@host/path?query";
So I removed the underscores from my database name and concrete5 connected no problem.