MySQL problems

MySQL problems

Eric Kemsley -
回帖数:32

Hello,

I am new to moodle and am having problems setting it up. I have tried on a windows 2000 server with IIS 5 and on red hat 7.3 with apache

On the windows box what do I put in for the location of the database? I have no idea where mysql put it when I installed mysql.

On the red hat box when I try to launch mysql, I get command not found.

here is the err file:
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
050520  9:00:18  InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
050520  9:00:20  InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 10 MB
InnoDB: Database physically writes the file full: wait...
050520  9:00:21  InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
050520  9:00:29  InnoDB: Started; log sequence number 0 0
C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqld-nt: ready for connections.
Version: '4.1.12-nt'  socket: ''  port: 3306  Official MySQL binary


TIA,

Eroc

回复Eric Kemsley

Re: MySQL problems

Paul Jessup -
On windows it should be in the directory C:\mysql. If you want to launch the admin tool it should be under C:\mysql\bin\winsqladmin.exe. 
回复Paul Jessup

Re: MySQL problems

Eric Kemsley -
I don't have a c:\mysql. The bin folder is C:\Program Files\MySQL\MySQL Server 4.1\bin, but I don't see that admin tool.
回复Eric Kemsley

Re: MySQL problems

Paul Jessup -
What did you use to install it?  Same for the RedHat version- it doesn't sound like it was installed properly.
回复Paul Jessup

Re: MySQL problems

Eric Kemsley -
On the windows box I just ran a setup.exe I downloaded from their site.
For the red hat box I used  MySQL-server-4.1.11-0.i386.rpm
回复Eric Kemsley

Re: MySQL problems

Paul Jessup -
That's odd.  That should have installed it into the C:\mysql directory, and should have started mysqladmin.exe when it finished.  
回复Paul Jessup

Re: MySQL problems

Eric Kemsley -
I am going to uninstall mysql, delete any folders with mysql and run the setup again.

After reinstalling the MySQl folder is C:\Program Files\MySQL with bin,+data,docs and +share as subfolders.

So where is the database located? The directions talk about a cpanel. How do i do it on the server itself? When I run the setup, does it create a database or is that something I have to do? If so, where are the directions for that?

Thanks

回复Eric Kemsley

Re: MySQL problems

Eric Kemsley -
I ran the MySQL command line client and made a database (db.opt is what is in the mymoodle folder). But when I point to that( C:\Program Files\MySQL\MySQL Server 4.1\data\mymoodle) I still get the error :
We could not connect to the database you specified. Please check your database settings.
回复Eric Kemsley

Re: MySQL problems

Herbert Keijers -
You wrote: "On the red hat box when I try to launch mysql, I get command not found."

On a RedHat box you should start MySQL server with:
/etc/rc.d/init.d/mysqld start

Use /etc/rc.d/init.d/mysqld status
to see if the process is running

回复Herbert Keijers

Re: MySQL problems

Eric Kemsley -
[root@moodle moodle]# /etc/rc.d/init.d/mysqld status
bash: /etc/rc.d/init.d/mysqld: No such file or directory
[root@moodle moodle]# /etc/rc.d/init.d/mysqld start
bash: /etc/rc.d/init.d/mysqld: No such file or directory

if I run /etc/init.d/mysql start it starts
[root@moodle moodle]# /etc/rc.d/init.d/mysql start
Starting MySQL SUCCESS!


[root@moodle moodle]# /etc/rc.d/init.d/mysqld status
bash: /etc/rc.d/init.d/mysqld: No such file or directory
[root@moodle moodle]# /etc/rc.d/init.d/mysqld start
bash: /etc/rc.d/init.d/mysqld: No such file or directory

回复Eric Kemsley

Re: MySQL problems

Herbert Keijers -
Can you give me the output of:
rpm -q mysql-server

Just checking if mysql is installed ...
回复Herbert Keijers

Re: MySQL problems

Eric Kemsley -
[root@moodle moodle]# rpm -q mysql-server
package mysql-server is not installed
but if it's not installed, how can I start the service?

[root@moodle cdrom]# rpm -i MySQL-server-4.1.11-0.i386.rpm
package MySQL-server-4.1.11-0 is already installed

回复Eric Kemsley

Re: MySQL problems

Herbert Keijers -
Eric, this is what I would do if I was in your situation.
Try to uninstall left overs of your "mysql install".
Fetch the pre-compiled rpm version for your distribution (redHat 7.3) from www.rpmfind.net
you need:
  • mysql (the client)
  • mysql-server (the server)
  • php-mysql (to let php talk to mysql)
If you really want to use your mysql version I think you must compile it yourself.
The mysql version recommended for RedHat 7.3 works fine with Moodle.

Good luck !
回复Herbert Keijers

Re: MySQL problems

Eric Kemsley -
Maybe the attachmnet will help. It looks like mysqld is running.
回复Eric Kemsley

Re: MySQL problems

Herbert Keijers -
Lets try a:
$ rpm -qa | grep mysql
you should a least get these 3 packages:
mysql-xxx
mysql-server-xxx
php-mysql-xxx

If so, lets investigate some more and try to contact mysql from the shell:
assuming your database (made already), is named moodle. xxx is your version.
User moodle has rights for database moodle.

$ mysql -u moodle -p
Enter password:<your password for moodle>
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10 to server version: xxx

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

mysql>use moodle;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql>show tables;
+-------------------------------------+
| Tables_in_moodle                    |
+-------------------------------------+
| adodb_logsql                           |
| mdl_assignment                       |
| mdl_assignment_submissions     |
| mdl_attendance                      |
...
| mdl_workshop_stockcomments |
| mdl_workshop_submissions       |
+-------------------------------------+
160 rows in set (0.00 sec)

mysql>quit;
Bye


Can you make a shell connection to MySQL ?
回复Herbert Keijers

Re: MySQL problems

Eric Kemsley -
There is no php-mysql and the show tables' says empty set
回复Eric Kemsley

Re: MySQL problems

Herbert Keijers -
You should install the correct version of php-mysql on your server.
Go to www.rpmfind.net and search your version.

Silly me, of course show tables said empty set because you haven't run the install script yet. Sorry for the confusion ...
At least you know the client can contact the mysql server, so it is running.
回复Herbert Keijers

Re: MySQL problems

Eric Kemsley -
I don't know what you mean about the correct version. I'm assuming it's the version for RedHat 9 of php-mysql. I can't find it. This is very frustrating!!!
回复Eric Kemsley

Re: MySQL problems

Herbert Keijers -
Inspect your php version. On a console (shell access) type:
# php -v

this will give you your php version.

Go to www.rpmfind.net and look for the same version of php-mysql
Install the rpm.

Hope this helps
回复Herbert Keijers

Re: MySQL problems

Eric Kemsley -
Thank you for bearing with me...I now have the php-mysql installed, but still get blank pages for the admin site.
回复Herbert Keijers

Re: MySQL problems

Eric Kemsley -
I get the error:

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

Any idea's?

回复Eric Kemsley

Re: MySQL problems

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

No - check the installation instructions and double check the bit about issuing the GRANT command on your Moodle database, make quite sure that the settings in config.php match.

Make sure mysql is running - I don't use Redhat but if you issue the command...

ps aux | grep mysql

You should get something rather like...

root      3300  0.0  0.0  2320 1120 ?        S    May09   0:00 /bin/sh /usr/bin/mysqld_safe --user=mysql --pid-file=/var/lib/mysql/mysqld.pid --socket=/var/lib/mysql/mysql.sock --datadir=/var/lib/mysql
mysql     3334  0.0  1.0 26152 21096 ?       S    May09   0:03 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/libmysql/mysqld.pid --skip-locking --port=3306 --socket=/var/lib/mysql/mysql.sock
howard    7739  0.0  0.0  2608  716 pts/5    S+   21:23   0:00 grep mysql

The second line is the really important one - that's the mysql server process. If you only get the last line, then it isn't running - and hence the problem.

(You did start mysqld, yes? There's something in the graphical administration programme to start it, and make it start at boot time.)

回复Howard Miller

Re: MySQL problems

Eric Kemsley -

Thanks Howard it looks as if it is running:

root      1226  0.0  0.0  4184   48 ?        S    07:24   0:00 /bin/sh /usr/bin/safe_mysqld --defaults-file=/etc/my.cnf
mysql     1256  0.0  0.4 14012 1204 ?        S    07:24   0:00 [mysqld]
root      2143  0.0  0.2  3568  624 pts/0    S    14:45   0:00 grep mysql

回复Eric Kemsley

Re: MySQL problems

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

Ok, so that's one possible problem ticked off. Now can you get in using the username and password you have set up for Moodle. The command will be

mysql -u moodleuser -p moodle

(You will be asked for the password, replace 'moodle' with your db name if different, and/or moodleuser with your user name)

If you do get in, you can try the mysql command...

show tables;

but there may not be any yet, of course

回复Howard Miller

Re: MySQL problems

Eric Kemsley -

I can only get in if I use mysql -u root -p. But once in I get:

mysql> use moodle;
Database changed
mysql> show tables;
Empty set (0.00 sec)

my url is http://moodle.esu13.org/mymoodle. I made a test page, test.php, and that does work.

回复Eric Kemsley

Re: MySQL problems

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像
Ok - did you do the GRANT command as per the install instructions? Do your config.php settings match the username and password in the GRANT command?

Your problem is, for whatever reason, your username and password (ie, the GRANT) is not correct.
回复Howard Miller

Re: MySQL problems

Eric Kemsley -

Thanks,

I have done the GRANT several times like this:

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROPINDEX,ALTER ON mymoodle.*
    ->
My config.php looks like this:

$CFG->dbtype    = 'mysql';       // mysql or postgres7 (for now)
$CFG->dbhost    = 'localhost';   // eg localhost or db.isp.com
$CFG->dbname    = 'mymoodle';      // database name, eg moodle
$CFG->dbuser    = 'moodleuser';    // your database username
$CFG->dbpass    = 'moodle';    // your database password
$CFG->prefix    = 'mdl_';        // Prefix to use for all table names

回复Eric Kemsley

Re: MySQL problems

Herbert Keijers -
Just to be on the save site ...
Can you give the output of:

mysql> show grants for moodleuser@localhost;
回复Herbert Keijers

Re: MySQL problems

Eric Kemsley -

mysql> show grants for moodleuser@localhost;
ERROR 1141: There is no such grant defined for user 'moodleuser' on host 'localhost'
mysql> Aborted

So I guess I have to try the GRANT again.

Maybe this will help as well:


$CFG->dbtype    = 'mysql';       // mysql or postgres7 (for now)
$CFG->dbhost    = 'localhost';   // eg localhost or db.isp.com
$CFG->dbname    = 'mymoodle';      // database name, eg moodle
$CFG->dbuser    = 'moodleuser';    // your database username
$CFG->dbpass    = 'moodle';    // your database password
$CFG->prefix    = 'mdl_';        // Prefix to use for all table names

$CFG->wwwroot   = 'http://moodle.esu13.org/mymoodle';

$CFG->dirroot= '/usr/moodle/mymoodle';

$CFG->dataroot = '/usr/moodle_data/mymoodle';

$CFG->directorypermissions = 0777;



回复Eric Kemsley

Re: MySQL problems

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

quite - looks like the GRANT command failed, or was typed incorrectly. It's quite easy to get wrong. You can probably just type...

 GRANT ALL ON mymoodle.* to moodleuser@localhost identified by 'moodle';
回复Eric Kemsley

Re: MySQL problems

Allen Arsenault -
I'm having the same problem, as mentioned.  I've read through the thread and checked my setup.  I am using root as the user (I know this is bad, I'm just testing at this point).  The permissions appear to be correct. The only differences is that we do not have internal DNS set up so I am using an IP number instead of the Domain name.

Is there anything else that can be checked?

I am new to mySql, is there a way to check if the moodle database is running?

Thanks,

Allen

回复Allen Arsenault

Re: MySQL problems

Eric Kemsley -

I'm not the guy to ask about moodle, but if your running linux the command to see if it's running I learned is

 ps aux | grep mysql