Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: jameswilson on February 15, 2010, 01:59:06 AM

Title: mysqlcheck appears not to run
Post by: jameswilson on February 15, 2010, 01:59:06 AM
hi all
I have been having major issues with 2 sme boxes running as virtual machines. I dont beleive them to be sme issues however, but beacuse they are crashing from time to time i get databases errors.

not usually a problem as mysqlcheck sorts them out.
But on one of the boxes the command

mysqlcheck --all-databases

immediatly returns to prompt. ie nothing seems to happen. no errors nothing.

I can access mysql from the command line but im kind of scared to mess around too much.

any suggestions?
Title: Re: mysqlcheck appears not to run
Post by: cactus on February 15, 2010, 10:50:35 AM
I can access mysql from the command line but im kind of scared to mess around too much.
How? By only typing mysql or do you need to add credentials?

A normal run of mysqlcheck --all-databases should check all databases on SME Server, did you perhaps modify the password for MySQL root user?
Title: Re: mysqlcheck appears not to run
Post by: jameswilson on February 15, 2010, 01:32:32 PM
no i didnt modify the password, i know that is a big no no

if i type "mysql" i dont have to provide any additional auth to login.
I presume something has become damaged from the regular crashes.
Title: Re: mysqlcheck appears not to run
Post by: cactus on February 15, 2010, 02:01:11 PM
no i didnt modify the password, i know that is a big no no

if i type "mysql" i dont have to provide any additional auth to login.
I presume something has become damaged from the regular crashes.
Strange... and there is no ouptut at all? Not even something about an error message?

Did you already try:
Code: [Select]
mysqlcheck --all-databases --verbose --analyze --force
If that does not work you could try checking per database if you know which databases are on the system by replacing
Code: [Select]
--all-databases with
Code: [Select]
--database dbname
Title: Re: mysqlcheck appears not to run
Post by: jameswilson on February 15, 2010, 10:39:38 PM

output from what i would normally
Quote
[root@bart ~]# mysqlcheck --all-databases
[root@bart ~]#

using your suggestion and output
Quote
[root@bart ~]# mysqlcheck --all-databases --verbose --analyze --force
# Connecting to localhost...
# Disconnecting from localhost...
[root@bart ~]#

does that help?

Title: Re: mysqlcheck appears not to run
Post by: cactus on February 15, 2010, 10:50:57 PM
does that help?
No, not really... what is the output of:
Code: [Select]
ls -la /var/lib/mysql/
Title: Re: mysqlcheck appears not to run
Post by: jameswilson on February 15, 2010, 11:03:29 PM

Quote
drwxr-xr-x  18 mysql mysql  4096 Feb 15 00:40 .
drwxr-xr-x  24 root  root   4096 Oct  2 09:07 ..
drwx------   2 mysql mysql  4096 Nov 27 00:03 db1
drwx------   2 mysql mysql 36864 Feb  6 11:59 db2
drwx------   2 mysql mysql  4096 Feb  6 14:09 horde
drwx------   2 mysql mysql  4096 Feb  6 11:59 db3
drwx------   2 mysql mysql  4096 Feb  6 14:09 mysql
srwxrwxrwx   1 mysql mysql     0 Feb 15 00:40 mysql.sock
drwx------   2 mysql mysql  4096 Feb 10 08:50 db4
drwx------   2 mysql mysql  4096 Nov 27 00:03 db5
drwx------   2 mysql mysql  4096 Nov 27 00:03 db6
drwxr-x---   2 mysql mysql  4096 Feb 14 23:37 db7
drwx------   2 mysql mysql  4096 Nov 15 20:08 db8
drwx------   2 mysql mysql  4096 Nov 27 00:04 db9
drwx------   2 mysql mysql  4096 May 24  2009 test
drwx------   2 mysql mysql  4096 Nov 27 00:04 db10
drwx------   2 mysql mysql 49152 Nov 27 00:04 db11
drwx------   2 mysql mysql  4096 Nov 27 00:04 db12
drwx------   2 mysql mysql  4096 Nov 27 00:04 db13

changed the db names but does that help?
Title: Re: mysqlcheck appears not to run
Post by: cactus on February 15, 2010, 11:09:52 PM
changed the db names but does that help?
You did what and how? Did you do that before or after you experienced problems? Did you shutdown MySQL when you did that?

Please do not start messing around while troubleshooting.

Can you still login to MySQL from the root account? If so please do and see what is the output of the following command inside the MySQL shell:
Code: [Select]
CHECK TABLE mysql.user, mysql.host, mysql.db, mysql.tables_priv, mysql.columns_priv;
Title: Re: mysqlcheck appears not to run
Post by: jameswilson on February 15, 2010, 11:28:24 PM
i chnaged the db names from the screenshot to prevent any useful info. I have not chnaged anything on the system nor messed about.

Quote
[root@bart ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 347 to server version: 4.1.22

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

mysql> CHECK TABLE mysql.user, mysql.host, mysql.db, mysql.tables_priv, mysql.columns_priv;
ERROR 1142 (42000): SELECT command denied to user 'root'@'localhost' for table 'user'
mysql>
nothing modified in case i get in trouble again ;)
thanks for your help so far cactus.

James
Title: Re: mysqlcheck appears not to run
Post by: jameswilson on February 15, 2010, 11:29:07 PM
im assuming from the above there is something wrong with the root account?
Title: Re: mysqlcheck appears not to run
Post by: cactus on February 16, 2010, 07:30:33 AM
im assuming from the above there is something wrong with the root account?
I guess so. Try this: http://wiki.contribs.org/MySQL#Restoring_accidently_deleted_MySQL_root_user
Title: Re: mysqlcheck appears not to run
Post by: CharlieBrady on February 16, 2010, 03:55:01 PM
I guess so. Try this: http://wiki.contribs.org/MySQL#Restoring_accidently_deleted_MySQL_root_user

From what is shown above, the problem is not with the password, but with the permissions stored in the mysql db. Presumably jameswilson changed something which he shouldn't have. mysql documentation website should contain advice as to how to fix the problem, which isn't SME specific.

Title: Re: mysqlcheck appears not to run
Post by: cactus on February 16, 2010, 04:31:14 PM
From what is shown above, the problem is not with the password, but with the permissions stored in the mysql db. Presumably jameswilson changed something which he shouldn't have. mysql documentation website should contain advice as to how to fix the problem, which isn't SME specific.
I know it is not the password as OP can login, but the link to the wiki I provided links directly to the instructions to reset permissions, which you suggested might be the solution as well.
Title: Re: mysqlcheck appears not to run
Post by: jameswilson on February 16, 2010, 04:36:10 PM
I havnt chnaged anything on this box charlie. I tend to leave them alone.

following on from what charlie said the root user had no priveliges. I added them all and now mysql check is working.

Many thanks all. Now i need to work out why and how that happened