B

Konfiguracja serwerów, usług, itp.
Optymist
Posty: 4
Rejestracja: 21 października 2012, 18:09

Błąd w połączeniu z bazą mysql

Post autor: Optymist »

Witam.

Nie będę ukrywał, że to mój pierwszy miesiąc z serwerem na Debianie lecz dość intensywny - spędziłem już ponad 12 godzin nad rozwiązaniem tego problemu i już brak mi punktu zaczepienia co może być nie tak. Udało mi się wszystko zainstalować, uruchomić i jakieś 2 tygodnie wszystko działało mi normalnie, aż do momentu, w którym uległo uszkodzeniu połączenie z mysql. Kupiłem serwer na Debianie bo chciałem się czegoś nowego nauczyć, ale trochę mnie to przerasta w tym momencie.

Jedynie czego nie robiłem jeszcze to przeinstalowanie mysql bo jeżeli działało to dziwne, żeby to miało mi pomóc więc się z tym wstrzymałem.

Direct Admin

Kod: Zaznacz cały

Error connecting to MySQL: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Plik oczywiście nie istnieje. Nie daje nic utworzenie go.
[TABLE="class: list table-highlight"]
[TR]
[TD]Apache 2.2.23[/TD]
[TD]*** Zatrzymane ***[/TD]
[/TR]
[TR]
[TD="class: list2"]DirectAdmin 1.41.1[/TD]
[TD="class: list2"]Uruchomione[/TD]
[/TR]
[TR]
[TD]Exim 4.73[/TD]
[TD]Uruchomione[/TD]
[/TR]
[TR]
[TD="class: list2"]MySQL 5.1.65[/TD]
[TD="class: list2"]*** Zatrzymane ***[/TD]
[/TR]
[TR]
[TD]Named 9.7.3[/TD]
[TD]Uruchomione[/TD]
[/TR]
[TR]
[TD="class: list2"]ProFTPd 1.3.3d[/TD]
[TD="class: list2"]Uruchomione[/TD]
[/TR]
[TR]
[TD]sshd[/TD]
[TD]Uruchomione[/TD]
[/TR]
[TR]
[TD="class: list2"]dovecot 2.1.10[/TD]
[TD="class: list2"]Uruchomione[/TD]
[/TR]
[TR]
[TD]Php 5.3.17[/TD]
[TD]Zainstalowano[/TD]
[/TR]
[/TABLE]

W Direct Adminie jest informacja, że zatrzymane, a tutaj, że działa choć sam nie wiem czy chodzi o ten sam serwer apache.

Kod: Zaznacz cały

root@s1:~# /etc/init.d/apache2 status
Apache2 is running (pid 5893). 

my.cnf

Kod: Zaznacz cały

# Example MySQL config file for very large systems.
#
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/mysql5/var) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password    = your_password
port        = 3306
socket        = /var/run/mysqld/mysqld.sock

default-character-set=latin1

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
skip-grant-tables
port        = 3306
socket        = /var/run/mysqld/mysqld.sock

#skip-locking
key_buffer = 384M
max_allowed_packet = 1M
table_cache = 8192
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
local-infile=0
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
character-set-server=latin1
collation-server=latin1_swedish_ci

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
# 
#skip-networking
bind-address = 127.0.0.1
# Disable Federated by default
skip-federated

# Replication Master Server (default)
# binary logging is required for replication
# log-bin=mysql-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id    = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =   <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port     =  <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin

# Point the following paths to different dedicated disks
#tmpdir        = /tmp/        
#log-update     = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 384M
#bdb_max_lock = 100000

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql5/var/
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql5/var/
#innodb_log_arch_dir = /usr/local/mysql5/var/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 384M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 100M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
skip-innodb

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]

key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout


Logi

/var/log/directadmin/errortasq.log

Kod: Zaznacz cały

2012:11:15-20:15:01: Error starting service httpd : uid 0 gid 0 : /etc/init.d/httpd start                           >>/dev/null 2>>/dev/null                     
2012:11:15-20:15:11: service httpd didn't start, re-starting it
2012:11:15-20:15:11: Error restarting service httpd : uid 0 gid 0 : /etc/init.d/httpd restart                           >>/dev/null 2>>/dev/null                     
2012:11:15-20:15:21: service mysqld wasn't running, starting it
/var/log/directadmin/system.log

Kod: Zaznacz cały

2012:11:15-20:13:21: mysqld started
2012:11:15-20:13:36: mysqld restarted
2012:11:15-20:14:21: mysqld started
2012:11:15-20:14:36: mysqld restarted
2012:11:15-20:15:21: mysqld started
2012:11:15-20:15:36: mysqld restarted
2012:11:15-20:16:22: mysqld started
/var/log/directadmin/error.log

Kod: Zaznacz cały

2012:11:14-22:22:57: Socket write error: fd is connected to a pipe or socket whose reading end is closed.  When this  happens the writing process will also receive a SIG_PIPE signal.  (Thus, the write return value is seen only if  the program catches, blocks or ignores this signal.)
2012:11:15-19:25:06: Socket write error: fd is connected to a pipe or socket whose reading end is closed.  When this  happens the writing process will also receive a SIG_PIPE signal.  (Thus, the write return value is seen only if  the program catches, blocks or ignores this signal.)
2012:11:15-19:25:06: Error while sending ./data/skins/enhanced/lang/pl/images/header.jpg
2012:11:15-19:25:15: Socket write error: fd is connected to a pipe or socket whose reading end is closed.  When this  happens the writing process will also receive a SIG_PIPE signal.  (Thus, the write return value is seen only if  the program catches, blocks or ignores this signal.)
2012:11:15-19:26:29: Socket write error: fd is connected to a pipe or socket whose reading end is closed.  When this  happens the writing process will also receive a SIG_PIPE signal.  (Thus, the write return value is seen only if  the program catches, blocks or ignores this signal.
/var/log/httpd/error_log.log

Kod: Zaznacz cały

[Thu Nov 15 19:32:01 2012] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "s1.omen"
Configuration Failed
[Thu Nov 15 19:32:11 2012] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "s1.omen"
Configuration Failed
[Thu Nov 15 19:32:21 2012] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "s1.omen"
Configuration Failed
/home/mysql/*.error
Z włączonym i wyłączonym innodb, o którym nie do końca wiem co robi.

Kod: Zaznacz cały

121114 10:42:37  InnoDB: Starting shutdown...
121114 10:42:42  InnoDB: Shutdown completed; log sequence number 0 1595675
121114 10:42:42 [Note] 
121114 10:42:42 mysqld_safe mysqld from pid file /usr/local/mysql/data/s1.pid ended
121114 10:43:21 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
121114 10:43:21 [ERROR] Can't find messagefile '/usr/share/mysql/english/errmsg.sys'
121114 10:43:21 [Note] Plugin 'FEDERATED' is disabled.
121114 10:43:21  InnoDB: Initializing buffer pool, size = 8.0M
121114 10:43:21  InnoDB: Completed initialization of buffer pool
121114 10:43:21  InnoDB: Started; log sequence number 0 1595675
121114 10:43:21 [ERROR] Aborting 

Kod: Zaznacz cały

121115 20:48:21 [Note] 
121115 20:48:21 mysqld_safe mysqld from pid file /usr/local/mysql/data/s1.pid ended
121115 20:48:36 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
121115 20:48:36 [ERROR] Can't find messagefile '/usr/share/mysql/english/errmsg.sys'
121115 20:48:36 [Note] Plugin 'FEDERATED' is disabled.
121115 20:48:36 [Note] Plugin 'InnoDB' is disabled.
121115 20:48:36 [ERROR] Aborting

Dziękuję z góry za jakieś rady albo podpowiedź na czym się skupić, ponieważ, robiąc jedno natrafiam na następne i już się pogubiłem, co jako pierwsze powinienm próbować naprawić.
sethiel
Junior Member
Posty: 762
Rejestracja: 28 stycznia 2008, 11:50
Lokalizacja: Wrocław

Post autor: sethiel »

Optymist
Posty: 4
Rejestracja: 21 października 2012, 18:09

Post autor: Optymist »

Dziękuję! Ilość błędów jednak była zbyt duża, żeby się bawić w dochodzenie co jest nie tak dlatego przeinstalowałem mysql i zaskoczyło wszystko na szczęście.

Teraz mam drugi problem i nie mogę nigdzie znaleźć odpowiedzi i dlatego korzystając z otwartego tematu:

Jak mam zrobić, aby domena, którą podpinam była dostępna w Direct Adminie (pliki strony), a nie w katalogu /var/www/? Jakoś to miesiąc temu zrobiłem, ale niestety nie pamiętam.
Robiłem sobie według tego poradnika i podpięcie poszło, ale nie o to mi chodzi:
http://www.youtube.com/watch?v=2vA2Yzv-NoI
sethiel
Junior Member
Posty: 762
Rejestracja: 28 stycznia 2008, 11:50
Lokalizacja: Wrocław

Post autor: sethiel »

Może ci chodzi o konfigurację www i wirtualnych maszyn?
"Document root" - czy jakoś tak...
Optymist
Posty: 4
Rejestracja: 21 października 2012, 18:09

Post autor: Optymist »

sethiel pisze:Może ci chodzi o konfigurację www i wirtualnych maszyn?
"Document root" - czy jakoś tak...
Chodzi mi o to, aby stroną, którą dodam w Direct Adminie była dostępna w Menadżer Plików w Direct Adminie. Potrafię zrobić, żeby strona i jej katalog stworzony w /var/www/ się wyświetliła, ale z tego co widzę to nie ma żadnego połączenia z Menadżerem plików w Direct Adminie. Chciałbym tam zarządzać stroną, a nie wszystko przez konsolę robić.

Nie wiem wiem czego dokładnie szukać, aby znaleźć jakieś pomoce na ten temat. Wszystko co znalazłem rozbija się o podłączenie /var/www/domena i host.
sethiel
Junior Member
Posty: 762
Rejestracja: 28 stycznia 2008, 11:50
Lokalizacja: Wrocław

Post autor: sethiel »

Pojęcia nie mam co to DirectAdmin. Ale na 99% chodzi o virtualki. Wrzuć (usuń komentarze) właściwy konfiguracyjny plik apache2.
/etc/apache2/??... - może to być apache2.conf - jeśli tam masz wszytko, a może masz coś zgodnie z Include (czyli pliki dodawane do konfiguracji głównej) odpowiedzialne za virtualki, np u mnie to wygląda tak:

Kod: Zaznacz cały

Include conf.d/
Include sites-enabled/
Include /etc/apache2/virtualki.conf
I w pliku virtualki.conf mam wszystkie subdomeny. (Co jak się okazuje jest jednak na dłuższą metę już niedobre - przy 10 subdomenach to jeszcze się idzie połapać, ale obecnie to już mega sajgon).

Aha, nie umieściłem najważniejszego dla Ciebie, przykładowy wpis wirtualki:

Kod: Zaznacz cały

<VirtualHost *:80>
        DocumentRoot /virtual/www/pomoc
        ServerName pomoc.pomoc.pl
        ServerAlias     [url=http://www.pomoc.pomoc.pl]www.pomoc.pomoc.pl[/URL]
        ServerAdmin [EMAIL="pomoc@pomoc.pl"]pomoc@pomoc.pl[/EMAIL]
        ServerSignature Off
        Alias /pomoc /virtual/www/pomoc/upload
        CustomLog /var/log/apache2/pomoc.log combined
        ErrorLog /var/log/apache2/pomoc.error.log
</VirtualHost>
Optymist
Posty: 4
Rejestracja: 21 października 2012, 18:09

Post autor: Optymist »

Dokładnie chodziło mi o wirtualny host tylko nie wiedziałem, że tak się to zwie.
Ustawiłem to, tylko jestem dość ograniczony w kwestii katalogu, ponieważ chciałbym, aby to był katalog Direct Admina co niesie za sobą kolejny problem.

Kod: Zaznacz cały

<VirtualHost *:80>
        ServerAdmin webmaster@example.com
        ServerName  mojastrona.com
        ServerAlias mojastrona.com

        # Indexes + Directory Root.
        DirectoryIndex index.html
        DocumentRoot /home/admin/domains/mojastrona.com/public_html

       
</VirtualHost>
Ustawienie czysto testowe zaskoczyło, jednak dostaję brak dostępu po przejściu na stronę - ustawiłem całą ścieżkę na 755 co chyba nie jest zbyt bezpieczne, ale i to nie zadziałało więc może jakieś pomysły? Zależy mi na tej lokalizacji z powodu domyślnego przechowywania tam plików po stworzeniu domeny w Direct Adminie.

Kod: Zaznacz cały

[h=1]Forbidden[/h] You don't have permission to access / on this server.
sethiel
Junior Member
Posty: 762
Rejestracja: 28 stycznia 2008, 11:50
Lokalizacja: Wrocław

Post autor: sethiel »

słowo klucz "permission"

Kod: Zaznacz cały

chown -R www-data:www-data /home/admin/domains/mojastrona.com/public_html
ODPOWIEDZ