MySQL databsae access

MySQL databsae access

by DeWayne Demland -
Number of replies: 2
I have tried to import a database file from Mysql in moodle. I get an authorization error seen below. I had moodle installed thorough the host site dashboard, GoDaddy. It had me add a password to the database that was not required when I installed in on my local drive when I was testing. Now I can not use the import feature through MySQL. This was printed on one the of help pages:
  • This example describes using PHP to connect to a MySQL Database on a Linux hosting account.
  • <?php
    //Connect To Database
    $hostname='aut0921707453068.db.2099013.hostedresource.com';
    $username='aut0921707453068';
    $password='your password';
    $dbname='aut0921707453068';
    $usertable='your_tablename';
    $yourfield = 'your_field';

    mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');
    mysql_select_db($dbname);

    $query = 'SELECT * FROM $usertable';
    $result = mysql_query($query);
    if($result) {
    while($row = mysql_fetch_array($result)){
    $name = $row['$yourfield'];
    echo 'Name: '.$name;
    }
    }
    ?>
I have what I think is a some what simple question, where do I find this file and modify it. I am sick of having the host modify the SQL files so I can restore them. I would like to use the moodle program like it is designed. I used this feature on my local drive test and it works fine. I would like to continue using it the same way. Can anyone help me resolve this? Thanks.

Attachment Database.jpg
Average of ratings: -
In reply to DeWayne Demland

Re: MySQL databsae access

by Lisa Dodson -

Are you referring to changing the password on the MySQL database?

You can do this through GoDaddy's hosting control manager.  Open up control manager, go to databases, and select edit on the database you want to change.  Select "password" and you can change the password from there.

You will have to remember to edit your config.php file in Moodle root folder to the updated password or your moodle will not work at all.

In reply to Lisa Dodson

Re: MySQL databsae access

by DeWayne Demland -
Maybe I miss stated the problem, Godaddy will not allow new databases to be created apparently. You must request that to be done by their tech people. Within moodle in the PHPmyAdmin when you import the sql file, it creates a new database, in which Go daddy does not allow the user the authorization for that proceedure, thus the error that you see in the post. If you go into the PHPmyAdmin in moodle it states that the user doe not have the ability to create a new database.I assume that you have a Godaddy account and using it for moodle, did you ever install moodle on a local drive to test it and see how it works? There are things that I can not do on my Godaddy that I can do on my local installation of moodle. Do you back up you databases through Godaddy's interface? Kind of a pain to have to do this separately, when it is all capable to do through moodle, don't you think?