Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by Dallas Ray Smetter -
Number of replies: 13
This is really bugging me and I have spent a lot of time on it. I am ready for some input from other, possibly better, minds!

I am preparing to train some tech support people on how to install Moodle on Fedora Core 3. I have installed Moodle many times, but usually with cPanel help as far as the db creation goes.

I have created the db and the db user w/password appropriately. I can do anything I want with the database via mysql command line interface. Here's what I did just to test that my user has the access it needs. Logging in as moodle in mysql, I can add tables and data etc. to my db. But when I get to the database configuration page in the Moodle web-based installation procedure, I get the error: "We could not connect to the database you specified. Please check your database settings."

What should I check next? Or should I just build the config file by hand  and give it a whirl?
Average of ratings: -
In reply to Dallas Ray Smetter

Re: Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by Rickard Carlsson -

I have the exact same problem! I can also access the database using my moodle account and add tables and such but when I return to the installation I get the same error as you; "We could not connect to the database... and so on"

Lets hope someone can help us out!

In reply to Rickard Carlsson

Re: Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by Tracee Johnson -
We are new to Moodle and are trying to get it installed on our test server but are receiving the same error when trying to connect in the installation; however, we are also getting an error in MySql.  When we attempt to assign all of the privileges to moodleuser, we receive 'error while storing the user information.'  At first, we can go back and the privileges seemed to have been assigned anyway.  But, you can later go back, and the rights are no longer assigned.  Really strange.  We are new to MySql as well.  Can anyone provide any input on what we are doing wrong?
In reply to Dallas Ray Smetter

Re: Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by Zbigniew Fiedorowicz -
Perhaps it could be this problem:
http://dev.mysql.com/doc/mysql/en/old-client.html
(Scroll down to the note about PHP.)

In reply to Zbigniew Fiedorowicz

Re: Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by Tracee Johnson -
Thank you so much.  That was it!!
In reply to Dallas Ray Smetter

Re: Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by raju malav -
hi dear...
i have installed moodle 1.4 on fedora core 3 i also got lot of problems during installation..

u may give me ur mail id i would send u my config.php and httpd.conf file ..u just put them into ur /etc/httpd/conf/ directory.. and config.php in ur moodle directory..ok
i installed moodle in /usr/moodle/mymoodle.. directory.. and moodle data in /usr/moodle_data/mymoodle and created a dataabase for mymoodle in mysql for the user root and password root123..
and at last plzz disable the selinux by typing folowwoing command in terminal..setenforce 0
thsi will allow apache to  connect with mysql database...
this will surely help to you..
regards..
Raju
In reply to raju malav

Re: Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by umesh chavan -
hello dear raju...
this is umesh frm pune,india...
i tried installing moodle on linux red hat 9...but it is giving error called cant connect to MySql database so recompile ur php.ini file....
can u guide me on this ?
and one more thing am i suppose to create a database in mysql ? wherein i don know abt sql....

the other tool foe test phptest and php test manager i tried installing bt same error abt sql db..so kindly help me ...

regards

umesh chavan

In reply to umesh chavan

Re: Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by raju malav -
hi dear/....no problem..i am here..my mail id is raju_dhakar2002@hotmail.com

you can mail me ur every doubt...i can easily fell ur problem how much problems u will be getting right now..becux same was case with me..

anyhow if u can come to yahoo mesaaner after 9.30 i can solve ur doubts online...tt will be more benefitial for you as i think,..u can ask ur probs..

so dear first u have to disable ur selinux by this command...in shell
type the foloowing command..
setenforce 0
it helps to excess apache with mysql..
now come to config.php file..
set the folling parameters...
like database user and password as root and password is root123 and be ware that u r using same id and password that u were using in mysql..
actually i installed it in /usr/moodle/mymoodle direcroty and data in /usr/moodle_data/mymoodle
and i advise you to do the same....
what more u want to knoe send me in details..
regards..
raju

 
In reply to umesh chavan

Re: Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by Zbigniew Fiedorowicz -
I've submitted the following entry to the FAQ concerning this:

If you get errors like "database connection failed" or "could not connect to the database you specified", here are some possible reasons and some possible solutions.
  1. Your database server isn't installed or running. To check this for MySQL try typing the following command line
    telnet database_host_name 3306
    You should get a cryptic response which includes the version number of the MySQL server.
  2. You don't have the PHP mysql or postgresql extensions installed. To check for this, create a new file on your web site called info.php, containing the following text, and call it from your browser:
    <?PHP phpinfo() ?>
    and see if any information about mysql or postgresql is displayed.
  3. You haven't created a database for Moodle and assigned a user with the correct privileges to access it. Or the database name, database user or database user password in your Moodle configuration file config.php are incorrect. Use phpMyAdmin to set up and check your MySQL installation.
  4. You are using MySQL version 4.1 or higher, whose default password hashing algorithm is incompatible with that available in PHP versions 4.x.x. See http://dev.mysql.com/doc/mysql/en/old-client.html for further information on how to deal with this.
  5. You are using Fedora core 3 or some other Linux system with SELinux installed and enabled. See the following URL for information on how to disable SELinux: http://fedora.redhat.com/projects/selinux/


In reply to Zbigniew Fiedorowicz

Re: Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by Griff Jon -
I've gone through these steps and still can't resolve this problem.  php-mysql is installed, it's a debian system, and MediaWiki (which also uses php-mysql) works.

I've set the passwords all to the old password method, created a schema for moodle, and even if I use the root user it fails.
In reply to Dallas Ray Smetter

Re: Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by Dallas Ray Smetter -
I fixed it easily be reinstalling the OS and DISABLING selinux. Don't ask me why that worked but that's the only thing I did differently.
In reply to Dallas Ray Smetter

mysql db cant connect to php.ini

by umesh chavan -

am tring to install moodle on redhat9 ,having php 4.2, mysql n apache enabled....

bt when start installation ot says

PHP has not been properly configured with the MySQL extension so that it can communicate with MySQL. Please check your php.ini file or recompile PHP.

how can i solve this prob?

and am i suppose to create a database in mysql before installation?

kindly help

In reply to Dallas Ray Smetter

Re: Cannot access MySql DB, although its been created properly. I CAN use mysql commands nicely!

by Sean Keogh -
SELinux creates all kinds of access controls to prevent access to some parts of the system by other parts of the system.  So for example, one of the most common problems I've seen with Fedora three and Moodle is that Moodle's installation script can't seen the database, because SELInux is preventing PHP from attaching to the database.

If Fedora has been installed with SELinux you don't have to re-install it, you can put a parameter in the boot string (shown below) which inhibits SELinux:

edit /boot/grub/menu.lst and add "selinux=0" to the end of the line:
kernel hd(... showopts


Sean K Beardie