Advertisement:

Author Topic: [Solved]: osclass can't connect to mysql database,  (Read 3055 times)

fahad

  • Newbie
  • *
  • Posts: 9
[Solved]: osclass can't connect to mysql database,
« on: August 01, 2016, 03:08:54 am »
Hi folks,

I seem to have problems with connecting to database using osclass script. However, i have a plain php script to test if connection to database is possible and that works just fine.

During installation, with all green ticks (requirements) i proceed and when i provide database information like db name and username and password, on the very next page, it says "Osclass database is not available. Need more help?".

I have root access to mysql, i tried changing database and dbuser as well several times but futile.
Environment info is below:
OS = centos-release-6-8.el6.centos.12.3.x86_64
Mysql = 5.7.1
apache...

Its making me crazy. Plain php script can connect to database but osclass doesn't.
« Last Edit: August 03, 2016, 12:24:37 pm by fahad »

SteveJohnson

  • Sr. Member
  • ****
  • Posts: 328
  • Golden tip - Clear your cache :|
Re: osclass can't connect to mysql database,
« Reply #1 on: August 01, 2016, 07:28:56 am »
Mysql 5.7 is not compatible with osclass (out of the box) at the moment. Try with mysql 5.6 or 5.5

osclassLover

  • Newbie
  • *
  • Posts: 39
  • thinking to achieve new in osclass
Re: osclass can't connect to mysql database,
« Reply #2 on: August 01, 2016, 10:29:52 am »
have you created database?...did you try to give the mysql user name and password correctly?...

did you give the correct database name?...

fahad

  • Newbie
  • *
  • Posts: 9
Re: osclass can't connect to mysql database,
« Reply #3 on: August 01, 2016, 11:36:20 am »
Osclasslover, of course I created empty database, also allowed install script to create one for me, tried uploading already installed osclass on localhost and then changed config variables as well. In every case it didn't work.

Stevejohnson thanks for that info, I will try 5.6

fahad

  • Newbie
  • *
  • Posts: 9
Re: osclass can't connect to mysql database,
« Reply #4 on: August 01, 2016, 11:04:20 pm »
Downgraded to 5.6 version but still same problem. How can i generate logs of install script?

fahad

  • Newbie
  • *
  • Posts: 9
Re: osclass can't connect to mysql database,
« Reply #5 on: August 01, 2016, 11:40:59 pm »
It seems there is some problem in step 3 of installation as i debugged more.
It goes inside oc_install function but doesn't seem to process first lines of functions which are below:
  $dbhost      = Params::getParam('dbhost');
    $dbname      = Params::getParam('dbname');
    $username    = Params::getParam('username');
    $password    = Params::getParam('password', false, false);
    $tableprefix = Params::getParam('tableprefix');

after that execution stops... Either i get page not found error or script keeps on asking for changing table prefixes but never resolves.
What kind of permissions i need for which files?
Experts anyone can help?

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: osclass can't connect to mysql database,
« Reply #6 on: August 01, 2016, 11:43:58 pm »
Hi,

Are you sure your MySQL user (username) has all privileges required? ???

Try this in PhpMyAdmin or shell MySQL console:

Quote
CREATE DATABASE db_name;
CREATE USER 'username' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON db_name.* to 'username';
exit;

(Replace strings in orange)

Regards

fahad

  • Newbie
  • *
  • Posts: 9
Re: osclass can't connect to mysql database,
« Reply #7 on: August 01, 2016, 11:59:47 pm »
@teseo, yes it has access. I tried that script
As script creates all the tables. Now at step 3 page is blank.

Also config.php is generated with correct values. It's just that it doesn't take me to specify admin username and password.
« Last Edit: August 02, 2016, 12:02:58 am by fahad »

fahad

  • Newbie
  • *
  • Posts: 9
Re: osclass can't connect to mysql database,
« Reply #8 on: August 02, 2016, 12:34:38 pm »
Any expert please? Do you need some kind of logs to make some sense? or anything i can provide.

fahad

  • Newbie
  • *
  • Posts: 9
Re: osclass can't connect to mysql database,
« Reply #9 on: August 02, 2016, 04:38:36 pm »
Tried with osclass 3.3 version and still same issue.

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: osclass can't connect to mysql database,
« Reply #10 on: August 02, 2016, 04:56:56 pm »
Quote
"Osclass database is not available. Need more help?".

Either your database does not exists, or the mysql user you are using is incorrect. I don't think it has to do with Osclass but with your mysql configuration. Please, review the mysql credentials once more.

fahad

  • Newbie
  • *
  • Posts: 9
Re: osclass can't connect to mysql database,
« Reply #11 on: August 02, 2016, 05:28:11 pm »
@_CONEJO,

There was no issue with MySQL credentials at all. If a plain php script can connect to db without any problem why would osclass has any issue with it?

If it generates all tables to the specified database then it means that user has all privileges and db credentials are all correct.

But i figured out what the problem was.
It was PHP's mb_str function. That wasn't installed with PHP.
Installed that and now it's fixed.
I propose one should write a requirement for PHP, MySQL, and Apache and File permissions etc. Maybe i can do that in free time.


fahad

  • Newbie
  • *
  • Posts: 9
Re: osclass can't connect to mysql database,
« Reply #12 on: August 03, 2016, 12:27:15 am »
Thank you all Experts :) for your kind help!

osclassLover

  • Newbie
  • *
  • Posts: 39
  • thinking to achieve new in osclass
Re: osclass can't connect to mysql database,
« Reply #13 on: August 03, 2016, 10:16:56 am »
oh, thats really great news , this would really helpfull for someone, please ad [sovled]...