error mysql #2002 - problems of permissions ?

Discussion in 'Installation/Configuration' started by emmaluc, Apr 14, 2015.

  1. emmaluc

    emmaluc New Member

    Hi,
    I'll try to explain my (big) problem with my bad english.
    I tried to change permissions of files on one website, but i used a bad line. So now it's impossible for me to have an access on my phpmyadmin...
    All my websites are down (Database connection error (2): Could not connect to MySQL.)
    I can't connect to my ispconfig admin too...
    The line that i have used for my website : chown -R -v -f www-data:www-data web/*
    Is there someone can help me ?
    Thx
     
  2. cbj4074

    cbj4074 Member

    We must assume that you executed that command from within one of your website domain roots, e.g., /var/www/clients/clientX/webY; please mention if this assumption is incorrect.

    If this assumption is correct, then I do not see how this command could affect your ability to connect to MySQL, at least for permission-related reasons. All of MySQL's data files live in /var/lib/mysql, so unless you changed the permissions on that directory, too, the command you cited should not have changed permissions on the database files.

    Also, I do not see how this could affect your ability to use ISPConfig, as ISPConfig's application files reside outside of the directory in which you executed this command.

    Why not simply undo the change you made? For example (as root user):

    Code:
    # chown -R -v -f webX:clientY web/*
    
    where webX is the website ID (e.g., web1) and clientY is the client ID (e.g., client1)?
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    please post the output of:

    ls -la /var/lib/mysql/

    Btw. The files inside a website on a ISPConfig server should never be owned by www-data. the files have to be owend by the web user and client group of that website.
     
  4. emmaluc

    emmaluc New Member

    a friend help me to change chown for mysql, so now i can access to ispconfig & all my website, but i think there are others error of chown for others services...

    the result :
    Code:
    drwx------ 12 mysql    mysql        4096 avril 14 15:42 .
    drwxr-xr-x 44 www-data www-data     4096 févr. 19 14:39 ..
    drwx------  2 mysql    mysql       12288 mars  10 09:15 c1campmed
    drwx------  2 mysql    mysql       12288 avril 10 11:58 c2barboteu
    drwx------  2 mysql    mysql       12288 avril 14 11:36 c2formation
    drwx------  2 mysql    mysql       12288 mars  31 17:30 c2guasch
    drwx------  2 mysql    mysql        4096 mars  19 10:53 c3unelvent
    drwx------  2 mysql    mysql       12288 avril  9 14:18 c5campsud
    drwx------  2 mysql    mysql       12288 févr. 19 14:39 dbispconfig
    -rw-r--r--  1 mysql    mysql           0 févr. 19 14:34 debian-5.5.flag
    -rw-rw----  1 mysql    mysql    85983232 avril 15 09:48 ibdata1
    -rw-rw----  1 mysql    mysql     5242880 avril 15 09:48 ib_logfile0
    -rw-rw----  1 mysql    mysql     5242880 avril 15 09:32 ib_logfile1
    drwx------  2 mysql    mysql        4096 févr. 19 14:35 mysql
    -rw-------  1 mysql    mysql           6 févr. 19 14:35 mysql_upgrade_info
    drwx------  2 mysql    mysql        4096 févr. 19 14:35 performance_schema
    drwx------  2 mysql    mysql        4096 févr. 19 14:39 phpmyadmin
     
  5. emmaluc

    emmaluc New Member

    On my log folder i have this result :
    Code:
    -rw-r--r-- 1 www-data www-data     482 avril 14 12:23 alternatives.log
    -rw-r--r-- 1 www-data www-data    4597 févr. 19 14:38 alternatives.log.1
    drwxr-x--- 2 www-data www-data    4096 avril 12 06:25 apache2
    drwxr-xr-x 2 www-data www-data    4096 mars   1 06:25 apt
    -rw-r--r-- 1 www-data www-data    3747 avril 14 12:22 aptitude
    -rw-r----- 1 www-data www-data 2126510 avril 15 09:48 auth.log
    -rw-r----- 1 www-data www-data 5519676 avril 12 06:25 auth.log.1
    -rw-r----- 1 www-data www-data  363397 avril  5 06:25 auth.log.2.gz
    -rw-r----- 1 www-data www-data  294720 mars  29 06:25 auth.log.3.gz
    -rw-r----- 1 www-data www-data  301690 mars  22 06:25 auth.log.4.gz
    -rw-rw---- 1 www-data www-data       0 avril  1 06:25 btmp
    -rw-rw---- 1 www-data www-data       0 mars   1 06:25 btmp.1
    drwxr-xr-x 2 www-data www-data    4096 avril 12 06:25 clamav
    -rw-r----- 1 www-data www-data   53617 avril 15 09:48 daemon.log
    -rw-r----- 1 www-data www-data   43310 avril 12 04:16 daemon.log.1
    -rw-r----- 1 www-data www-data    3382 avril  5 06:23 daemon.log.2.gz
    -rw-r----- 1 www-data www-data    5414 mars  29 06:09 daemon.log.3.gz
    -rw-r----- 1 www-data www-data    3512 mars  22 05:55 daemon.log.4.gz
    drwxr-xr-x 2 www-data www-data    4096 févr. 19 14:37 dbconfig-common
    -rw-r----- 1 www-data www-data   15485 avril 14 15:32 debug
    -rw-r----- 1 www-data www-data    2361 avril 12 01:23 debug.1
    -rw-r----- 1 www-data www-data     264 avril  5 00:52 debug.2.gz
    -rw-r----- 1 www-data www-data     201 mars  26 17:40 debug.3.gz
    -rw-r----- 1 www-data www-data     287 mars  19 10:20 debug.4.gz
    -rw-r----- 1 www-data adm        36175 avril 14 12:48 dmesg
    -rw-r----- 1 www-data www-data   35674 févr. 19 14:30 dmesg.0
    -rw-r----- 1 www-data www-data      28 févr. 10  2014 dmesg.1.gz
    -rw-r--r-- 1 www-data www-data   46516 avril 14 12:23 dpkg.log
    -rw-r--r-- 1 www-data www-data  193578 févr. 19 14:39 dpkg.log.1
    -rw-r----- 1 www-data www-data   38014 avril 15 09:43 fail2ban.log
    -rw-r----- 1 www-data www-data   54792 avril 12 06:24 fail2ban.log.1
    -rw-r----- 1 www-data www-data    8729 avril  5 05:54 fail2ban.log.2.gz
    -rw-r----- 1 www-data www-data    5219 mars  29 04:28 fail2ban.log.3.gz
    -rw-r----- 1 www-data www-data    5482 mars  22 05:37 fail2ban.log.4.gz
    -rw-r--r-- 1 www-data www-data  160384 avril  9 14:04 faillog
    drwxr-xr-x 2 www-data www-data    4096 oct.  10  2012 fsck
    drwxr-xr-x 3 www-data www-data    4096 févr. 19 14:40 ispconfig
    -rw-r--r-- 1 www-data www-data   16743 févr. 19 14:40 ispconfig_install.log
    -rw-r----- 1 www-data www-data   62289 avril 14 12:50 kern.log
    -rw-r----- 1 www-data www-data    2613 avril 12 01:23 kern.log.1
    -rw-r----- 1 www-data www-data     522 avril  5 05:24 kern.log.2.gz
    -rw-r----- 1 www-data www-data     201 mars  26 17:40 kern.log.3.gz
    -rw-r----- 1 www-data www-data     317 mars  19 10:20 kern.log.4.gz
    -rw-rw-r-- 1 www-data www-data 1463504 avril 15 09:48 lastlog
    -rw-r----- 1 www-data www-data       0 févr. 10  2014 lpr.log
    -rw-r--r-- 1 www-data www-data     470 avril 14 12:48 mail.err
    -rw-r----- 1 www-data www-data  917529 avril 15 09:28 mail.info
    -rw-r----- 1 www-data www-data 2716609 avril 12 06:25 mail.info.1
    -rw-r----- 1 www-data www-data  221456 avril  5 06:25 mail.info.2.gz
    -rw-r----- 1 www-data www-data  243660 mars  29 06:25 mail.info.3.gz
    -rw-r----- 1 www-data www-data  189800 mars  22 06:25 mail.info.4.gz
    -rw-r--r-- 1 www-data www-data  917529 avril 15 09:28 mail.log
    -rw-r--r-- 1 www-data www-data 2716609 avril 12 06:25 mail.log.1
    -rw-r--r-- 1 www-data www-data  221456 avril  5 06:25 mail.log.2.gz
    -rw-r--r-- 1 www-data www-data  243660 mars  29 06:25 mail.log.3.gz
    -rw-r--r-- 1 www-data www-data  189800 mars  22 06:25 mail.log.4.gz
    drwxrws--- 2 www-data www-data    4096 avril 14 06:25 mailman
    -rw-r--r-- 1 www-data www-data   95349 avril 14 12:48 mail.warn
    -rw-r--r-- 1 www-data www-data  213600 avril 12 06:25 mail.warn.1
    -rw-r--r-- 1 www-data www-data   11392 avril  4 22:07 mail.warn.2.gz
    -rw-r--r-- 1 www-data www-data   17713 mars  29 06:23 mail.warn.3.gz
    -rw-r--r-- 1 www-data www-data    5179 mars  21 22:44 mail.warn.4.gz
    -rw-r--r-- 1 www-data www-data       0 févr. 19 14:38 memcached.log
    -rw-r--r-- 1 www-data www-data  166996 avril 15 09:42 messages
    -rw-r--r-- 1 www-data www-data  573941 avril 12 06:25 messages.1
    -rw-r--r-- 1 www-data www-data  215653 avril  5 06:25 messages.2.gz
    -rw-r--r-- 1 www-data www-data  199698 mars  29 06:25 messages.3.gz
    -rw-r--r-- 1 www-data www-data  150701 mars  22 06:25 messages.4.gz
    drwxr-s--- 2 mysql    adm         4096 févr. 19 14:34 mysql
    -rw-r----- 1 mysql    adm            0 févr. 19 14:34 mysql.err
    -rw-r----- 1 mysql    adm            0 avril 14 06:25 mysql.log
    -rw-r----- 1 mysql    adm           20 avril 13 06:25 mysql.log.1.gz
    -rw-r----- 1 mysql    adm           20 avril 12 06:25 mysql.log.2.gz
    -rw-r----- 1 mysql    adm           20 avril 11 06:25 mysql.log.3.gz
    -rw-r----- 1 mysql    adm           20 avril 10 06:25 mysql.log.4.gz
    -rw-r----- 1 mysql    adm           20 avril  9 06:25 mysql.log.5.gz
    -rw-r----- 1 mysql    adm           20 avril  8 06:25 mysql.log.6.gz
    -rw-r----- 1 mysql    adm           20 avril  7 06:25 mysql.log.7.gz
    drwxr-xr-x 2 www-data www-data    4096 avril 15  2013 news
    drwxr-xr-x 2 www-data www-data    4096 févr.  7 12:05 ntpstats
    drwxr-xr-x 2 www-data www-data    4096 avril 12 06:25 pure-ftpd
    -rw-r--r-- 1 www-data www-data       0 févr. 19 14:38 pycentral.log
    -rw-r----- 1 www-data www-data  120396 avril 13 23:01 rkhunter.log
    -rw-r----- 1 www-data www-data  120398 avril 11 23:01 rkhunter.log.1
    -rw-r----- 1 www-data www-data   13942 avril  4 23:01 rkhunter.log.2.gz
    -rw-r----- 1 www-data www-data   14005 mars  28 23:01 rkhunter.log.3.gz
    -rw-r----- 1 www-data www-data   13966 mars  21 23:00 rkhunter.log.4.gz
    -rw-r----- 1 www-data www-data  120402 avril 12 23:00 rkhunter.log.old
    drwxr-xr-x 2 www-data www-data    4096 mars   5 06:25 suphp
    -rw-r----- 1 www-data www-data 1425688 avril 15 09:50 syslog
    -rw-r----- 1 www-data www-data  889076 avril 14 06:25 syslog.1
    -rw-r----- 1 www-data www-data   64250 avril 13 06:25 syslog.2.gz
    -rw-r----- 1 www-data www-data   69869 avril 12 06:25 syslog.3.gz
    -rw-r----- 1 www-data www-data   63154 avril 11 06:25 syslog.4.gz
    -rw-r----- 1 www-data www-data   60552 avril 10 06:25 syslog.5.gz
    -rw-r----- 1 www-data www-data   58637 avril  9 06:25 syslog.6.gz
    -rw-r----- 1 www-data www-data   67306 avril  8 06:25 syslog.7.gz
    -rw-r----- 1 www-data www-data       0 févr. 10  2014 user.log
    -rw-rw-r-- 1 www-data www-data   10368 avril 15 09:48 wtmp
    -rw-rw-r-- 1 www-data www-data    3072 mars  17 11:10 wtmp.1
    Maybe i need to re-install all ?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Mysql is ok again but it seems as if you changes everything in /var to www-data. The files and folders in /var (and its subfolders) are owned by different users, so it will be a lot of work to change them back to the right owners (you probaly need a clean running linux for that to compare ownerships). So in the end, a reinstall might be faster then trying to fix the permissions.
     
  7. emmaluc

    emmaluc New Member

    So if i want to change chown on a specific website i need to use ? (with my root account)
    Code:
    # chown -R -v -f webX:clientY web/*
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes. But normally you dont have to chown at all as all files that are uploaded with an ftp account of the site or with a ssh user of that site are owned by the right user and group automatically.
     
  9. emmaluc

    emmaluc New Member

    Hello,
    I don't understand how it works...i have installed a new website (a joomla CMS)
    I have created a new user on my ispconfig.
    I use filezilla with my root account, to upload my files on my new website.
    After the installation, I don't have the correct rights to change my files on the joomal configuration.

    Some help website says to do this tips :

    Code:
    chown -hR -v -f root:client0 web/*
    cd web
    find . -type f -exec chmod 644 {} \;
    find . -type d -exec chmod 775 {} \;
    find . -type f -name "configuration.php" -exec chmod 664 {} \;
    find . -type f -name "*.ini" -exec chmod 664 {} \;
    find . -type f -name "*.css" -exec chmod 664 {} \;
    find . -type f -name ".htaccess" -exec chmod 755 {} \;
    Can you explain me the steps to do that ?
    I open my terminal & connect me as SSH user on my website. That's step is ok :)
    But after i don't know how to do it...
    If someone can help a beginner :)
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    The steps above are not required when you uploaded joomla with the ftp user of that website. If you dont have proper write eprmissions, then you most likely use a wrong php mode. The php mode has to be either php-fcgi or php-fpm and suexec has to be set to on in that website.
     
  11. emmaluc

    emmaluc New Member

    I don't understand.
    I have created a new website with this configuration
    [​IMG]
    I use my root account to upload my files by FTP.
    On my joomla premissions i have this :
    [​IMG]
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, thats the problem. If you would upload the website with an FTP user of the site, then you wont have to change any permissions. If you use the root user, then all files are owned by a wrong user and you have t chown them manually.
     
  13. emmaluc

    emmaluc New Member

    ah ok !
    So i need to create a FTP user first, & assign it to my website, and finally i use this account to connect me on my ftp filezilla ?
     
  14. emmaluc

    emmaluc New Member

    super it works !! thks a lot to take the time to explain !!
     

Share This Page