Author Topic: zentyal can't connect to mysql  (Read 5539 times)

robb

  • Guest
zentyal can't connect to mysql
« on: September 17, 2013, 01:31:23 pm »
With the last update of Samba I received the following error message:
Quote
Zentyal components
The following packages are not properly installed. You need to fix this before trying to use them or install new modules.
Component    Description    Version
zentyal-samba    Zentyal - File Sharing and Domain Services    3.1.12
To solve this situation, please try to execute the following command in the console:

sudo dpkg --configure -a

After the above command is finished you can reload this page. If the problem persists, you can ask for help in the community forum or file a ticket in the Zentyal trac.

It looks like the mysqlaccount 'zentyal' can't connect to the database. At least, that is what I understand from this errormessage. I did change the zentyal-mysql.passwd file in /var/lib/zentyal/conf because I had to import a .sql dump file that used other credentials. However, I set the .passwd back to it's original value and still zentyal can't connect to mysql.

Errormessage when performing sudo dpkg --configure -a:
Quote
/var/lib/zentyal/conf$ sudo dpkg --configure -a
Setting up zentyal-samba (3.1.12) ...
DBI connect('zentyal','zentyal',...) failed: Access denied for user 'zentyal'@'localhost' (using password: YES) at /usr/share/perl5/EBox/MyDBEngine.pm line 122
   (in cleanup) There wasn't a database connection, check if database exists\n at /usr/share/perl/5.14/Carp.pm line 79.
dpkg: error processing zentyal-samba (--configure):
 subprocess installed post-installation script returned error exit status 255
Errors were encountered while processing:
 zentyal-samba

Could it be that a new connection has to be created? If so, how? (i am an absolute n00b when it comes to mysql)

Any hints and tips how to solve this?

btw, I have phpmyadmin installed so I can do this through the phpmyadmin webpage or through mysql console.

/edit
I checked what privileges are set on the zentyal database.
In mysql console I queried: select * from SCHEMA_PRIVILEGES where TABLE_SCHEMA='zentyal';
reply was:
Code: [Select]
mysql> select * from SCHEMA_PRIVILEGES where TABLE_SCHEMA='zentyal';
+-----------------------+---------------+--------------+-------------------------+--------------+
| GRANTEE               | TABLE_CATALOG | TABLE_SCHEMA | PRIVILEGE_TYPE          | IS_GRANTABLE |
+-----------------------+---------------+--------------+-------------------------+--------------+
| 'zentyal'@'localhost' | def           | zentyal      | SELECT                  | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | INSERT                  | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | UPDATE                  | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | DELETE                  | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | CREATE                  | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | DROP                    | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | REFERENCES              | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | INDEX                   | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | ALTER                   | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | CREATE TEMPORARY TABLES | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | LOCK TABLES             | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | EXECUTE                 | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | CREATE VIEW             | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | SHOW VIEW               | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | CREATE ROUTINE          | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | ALTER ROUTINE           | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | EVENT                   | NO           |
| 'zentyal'@'localhost' | def           | zentyal      | TRIGGER                 | NO           |
+-----------------------+---------------+--------------+-------------------------+--------------+

So it looks like mysql user 'zentyal' has rights on the zentyal database??? So what is going wrong here? Or do I look at the wrong user or database?
« Last Edit: September 17, 2013, 06:22:45 pm by robb »

robb

  • Guest
Re: zentyal can't connect to mysql
« Reply #1 on: September 18, 2013, 10:37:12 am »
anyone?

christian

  • Guest
Re: zentyal can't connect to mysql
« Reply #2 on: September 18, 2013, 11:10:00 am »
password misalignment ? did you try to change it, both sides ?

robb

  • Guest
Re: zentyal can't connect to mysql
« Reply #3 on: September 18, 2013, 01:04:45 pm »
I tried to change the password.
As said, I am VERY unfamiliar with mysql but I probably can get the commands used back:
I set the password for mysqluser zentyal as follows:
Code: [Select]
SET PASSWORD FOR 'zentyal'@'localhost' = PASSWORD('<password>');
Then to be sure, grant the privileges for mysql user zentyal all on db zentyal:
Code: [Select]
grant all privileges on zentyal.* to zentyal@localhost identified by '<password>';

Am I doing something wrong with the syntax or something else?

sixstone

  • Zentyal Staff
  • Zen Hero
  • *****
  • Posts: 1417
  • Karma: +26/-0
    • View Profile
    • Sixstone's blog
Re: zentyal can't connect to mysql
« Reply #4 on: September 19, 2013, 12:11:25 am »
Hi Robb and Christian,

Zentyal code looks for the password on /var/lib/zentyal/conf/zentyal-mysql.passwd. So if you reset the zentyal user password in MySQL; make sure this file contains the same password.

The way to test this:
Code: [Select]
$ mysql -uzentyal -p<pass> zentyal
Best,
My secret is my silence...

robb

  • Guest
Re: zentyal can't connect to mysql
« Reply #5 on: September 19, 2013, 08:17:10 am »
sixtone, thnx for the answer. I knew this and I did check if the password matches the string in zentyal-mysql.passwd

When I perform that command, and use the string that is used in zentyal-mysql.passwd, I do get logged into the mysql console, so that looks like ok.

That's why I am a bit puzzled why I get this message that there is no database connection.
Can it be some privileges problem? However, I DID grant mysqluser zentyal all on zentyal.* databases... or should that just be zentyal?
« Last Edit: September 19, 2013, 09:51:56 am by robb »