Creating the mysql database

Creating the mysql database

Tom B發表於
Number of replies: 22

Error Message: "We could not connect to the database you specified. Please check your database settings."

Okay I'm making progress installing moodle but I got stuck at the create database part. Can I use cPanelX to create this database. How do I do that. I'm handy with html but I've never done anything like this before. My webhost is Lunarpages.com.

Now you need to configure the database where most Moodle data will be stored. This database must already have been created and a username and password created to access it.

 
Type: mysql or postgres7
Host: eg localhost or db.isp.com
Name: database name, eg moodle
User: your database username
Password: your database password
Tables Prefix: optional prefix to use for all table names

We could not connect to the database you specified. Please check your database settings.

評比平均分數: -
In reply to Tom B

Re: What Directory to Put the Moodle Files In

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
"But I remember something in the instructions about some moodle files that must NOT be put into my "public_html" folder"

It does? Where? No, that is definitely the place to put your moodle install.
In reply to Howard Miller

Re: What Directory to Put the Moodle Files In

W Page發表於
Hi Howard!

I think Tom B is really referring to the "moodledata" directory/folder which is suppose to be outside of the directory in which Moodle is installed.

WP1

In reply to W Page

Re: What Directory to Put the Moodle Files In

Tom B發表於

In fairness to Howard I should admit that I thought noone had responded to my question yet and I "edited" it (completely changed it). I had figured out my first problem. I'm still trying to solve problem 2. How to create and set permissions for the database file.

Thanks,

Tom

In reply to Tom B

Re: Creating the mysql database

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
I am neither familiar with cpanel or your host. However if you are using a host there are usually two possibilities. (1) You only have one mysql database, when you signed up you will have been told its name, its username and its password OR (2) you can create your own databases in which case cpanel almost certainly has a function for this and you can create your own database,username and password.

Either way, these three items of data are what you need to know for Moodle. Does this help?
In reply to Howard Miller

Re: Creating the mysql database

Andrew Millichamp發表於

I created ny database using cpanel x. If yours is the same as mine then:

Go into MySql Databases

At the bottom of the 'databases' section, enter a database name and click 'Add Db'.

In the Users section, add a new user and password.

At the bottom of the 'databases' section, select the new user and the new database and click 'Add user to db'.

Check that the new database now appears on the page, and includes the new user.

That's all you need to do for moodle. However, if you start writing web pages in php etc, you can create a database like this and then add, edit and populate tables by clicking on the phpMyAdmin link at the bottom of the page.

In reply to Howard Miller

Configure the Database

Tom B發表於

I used cPanelX to create the database.

I can see
database: moodle
user: balazs2

more specifically
database: balazs2_moodle
user: balazs2_balazs2

So the database has been created. Now I need to configure the database. That's where the install is stuck. I get the error message: "We could not connect to the database you specified. Please check your database settings."

Now what should I do.

In reply to Howard Miller

Re: Creating the mysql database

Tom B發表於

I found the below in another post in this forum:
Question 1: Since I didn't create the MySQL database before installing moodle do I now have to uninstall Moodle and reinstall it. (How do I uninstall? I assume it's not just deleting the folder.)

Question 2: If the answer is not to uninstall and reinstall then what should I do.

--------------------------------------------------------------------------

You must do a few things in advance before installing Moodle.

1. create a MySQL or Postgre database that has both a user name and password. For example:

  • db name: servername_moodle
  • db user: servername_samf
  • db password: letmein

2. create a data folder (moodledata) outside the public_html directory for Moodle to store course and student resources. Give this directory write permissions.

These things must be done before you attempt to install Moodle, otherwise you will get the types of error messages that you are reporting.

In reply to Tom B

Re: Creating the mysql database

Bryan Williams發表於

Tom,

No, you don't have to now uninstall Moodle since your tables were not populated by the installation script.

What table prefix are you using? Try entering mdl and see if this doesn't start the installation process, after entering information indicated in my other post. 

In reply to Bryan Williams

Re: Creating the mysql database

Tom B發表於

cPanelX shows me my user name and the database
us: balazs2_balazs2
table: balazs2_moodle

Is it using my username as the prefix or is that just a way of referring to the table. I'm not sure how to change the name. Maybe I should delete the database and create _mdl-moodle. What do you think? 

I can see that moodle install by default recommends the table prefix mdl_

In reply to Tom B

Re: Creating the mysql database

Tom B發表於

Victory, I now have Moodle installed on my website.

The answer was almost in my previous post. My webhosts helpdesk reminded me that cPanelX appends username to the beginning of the table's username and tablename.
us: balazs2_balazs2
table: balazs2_moodle

Once I made sure that it was entered that way in the google install I was almost done.

Thanks for all the help.

Tom

In reply to Tom B

Re: Creating the mysql database

Dan Cotton發表於

I have been fighting the same issue. tried all the variations of hostnames, server names, etc.

If I entered a blank password the screen would progress. Found issue with how moodle/php is talking to MySQL 4.X. It has to do with password has. from command line change password to "old style". Found this link on MSQL's site:

mysql> SET PASSWORD FOR
    -> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

http://dev.mysql.com/doc/mysql/en/old-client.html

it now works for me even with my password of choicebig grinbig grin

In reply to Dan Cotton

Re: Creating the mysql database

Sikandar Hayat發表於

 Hi,
I have installed Moodle and Mysql 4.1 and now trying to connect to database but unable to do so, I have performed the following steps.

1- Installed moodle
2- Installed mysql
3- connected to mysql from command line

Z:\>mysql -h LOCALHOST -u root -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 27 to server version: 4.1.10a-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+----------+
| Database |
+----------+
| awan     |
| mysql    |
| test     |
+----------+
3 rows in set (0.02 sec)

mysql>

4- Using url http://localhost/moodle/install.php trying to configure database and used the following detail,

Type = mysql

Host Server  = localhost

Database = mysql

user = root

password = abc

tables prefix = mdl_ (default)

After doing all above I a having the following error,

We could not connect to the database you specified. Please check your database settings.

Note: I am using windows XP, tried both (Firefox and MS IE).

Where I am missing anything.

Thanks.

In reply to Sikandar Hayat

Re: Creating the mysql database

Jan Dierckx發表於
You are right to set the database type to mysql, the database name should probably be something else.
From what you listed it seems you have 3 databases installed: awan, mysql and test
I believe mysql is used by the database server itself, so that one can not be used by Moodle.
If awan is not in use by another application you installed,
you can use that one.
So you should enter the following when the install script asks you for the database information:
Type = mysql
Host Server = localhost
Database = awan
user = root
password = abc
tables prefix = mdl_ (default)

If you don't want to use 'awan' you can probably add your own database (call it 'moodle') from the command line by following these directions in the installation manual.
Good luck (and be sure to change the database password when you put your moodle online!)

In reply to Tom B

Re: Creating the mysql database

raju malav發表於
hi dear....
u just mentioned ur problem but u forgot to mention on whick plateform you are installating your moodle software.
anyway i want to tell you that i have installed moodle 1.4. on linux fedora 3.
so as soon as u tell me about ur system, it will be more benifitial to you..
regards..
raju
In reply to raju malav

Re: Creating the mysql database

Sikandar Hayat發表於
Hi,
Well I am new to mysql so facing such issues. I had mentioned in my post about my plateform which is MS XP. Even now I have created another database moodle but still getting same error.

Thanks for your time.
In reply to Sikandar Hayat

Re: Creating the mysql database

Jan Dierckx發表於
After creating the new database, have you deleted the config.php file and rerun the install script?

In reply to Jan Dierckx

Re: Creating the mysql database

Sikandar Hayat發表於

Well I have deleted config.php located in moodle\admin folder but still no result. I don't know why I am unable to create a new user?

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON moodle.*
    ->            TO moodleuser@localhost IDENTIFIED BY 'hello';
Query OK, 0 rows affected (0.00 sec)

mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

mysql> show databases
    -> ;
+----------+
| Database |
+----------+
| awan     |
| moodle   |
| mysql    |
| test     |
+----------+
4 rows in set (0.03 sec)

mysql>

In reply to Sikandar Hayat

Re: Creating the mysql database

Sikandar Hayat發表於

After some RnD I found the following error by manually editing cofig.php,

localhost: Client does not support authentication protocol requested by server; consider upgrading MySQL client

Error: Database connection failed.

It is possible that the database is overloaded or otherwise not running properly.

The site administrator should also check that the database details have been correctly specified in config.php

In reply to Sikandar Hayat

Re: Creating the mysql database

J Orris發表於

Hello,

I am using Windows 2000 with IIS and I am getting the exact same error.  Have you found a solution?

In reply to Sikandar Hayat

Re: Creating the mysql database

Tony Hursh發表於
Did you do mysqladmin -p reload from the Unix command line after creating the new user? Entering the command flush privileges; at the mysql> prompt will also work.