Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Language specific forums Russian (Русский) Сервер баз данных
  • Search

Подключение к MySQL

Вопросы по работе Сервера баз данных
MySQL, PostgreSQL, MariaDB, Percona Server, phpMyAdmin, phpPgAdmin
Post Reply
  • Print view
Advanced search
2 posts • Page 1 of 1
ifelse
Posts: 4
Joined: Fri Dec 06, 2013 8:35 am

Подключение к MySQL
  • Quote

Post by ifelse » Sat Dec 14, 2013 9:58 am

Уже надоело воевать с MySQL.
Отвалилось подключение по localhost

Code: Select all

[root@classic ~]# mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
но работает по 127.0.0.1:

Code: Select all

[root@classic ~]# mysql -u root -h 127.0.0.1 -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 122
Server version: 5.5.35 MySQL Community Server (GPL) by Remi

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
/etc/my.cnf:

Code: Select all

[mysqld]
datadir=/var/lib/mysql
socket=/tmp/mysql.sock
user=mysql
symbolic-links=0
max_connections=200
max_user_connections=0
wait_timeout=30
interactive_timeout=50
long_query_time=5
#log-queries-not-using-indexes
#log-slow-queries=/var/log/mysql/log-slow-queries.log

#innodb_use_native_aio = 0
innodb_file_per_table


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Обратите внимание, что сокет отличается от сокета в ошибке при подключении.

Далее смотрим что у нас в ps:

Code: Select all

[root@classic ~]# ps ax | grep mysql
28176 pts/0    S      0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/tmp/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql

28455 pts/0    Sl     0:10 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/tmp/mysql.sock

29253 pts/0    S+     0:00 grep mysql
С mysqldump поведение аналогичное. Из-за данной проблемы создать базу данных в панеле невозможно (предполагаю, что панель коннектится по localhost).
Top

skid
VestaCP Team
Posts: 1476
Joined: Wed Apr 06, 2011 11:12 pm

Re: Подключение к MySQL
  • Quote

Post by skid » Wed Dec 18, 2013 9:33 pm

Попробуйте заменить путь для сокета в конфиге my.cnf на
socket=/var/lib/mysql/mysql.sock
Top


Post Reply
  • Print view

2 posts • Page 1 of 1

Return to “Сервер баз данных”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password