mysql -u root -h localhost -p и Can't connect to local MySQL server...
v22 20 июля, 2006 - 18:22
как исправить ету ошибку
mysql -u root -h localhost -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
но если сделать так
mysql -u root -h 127.0.0.1 -p
тогда все ок ???? почему???
»
- Для комментирования войдите или зарегистрируйтесь
Покажи: cat /etc/hosts
Покажи:
ку
# /etc/hosts: Local Host Database
#
# This file describes a number of aliases-to-address mappings for the for
# local hosts that share this file.
#
# In the presence of the domain name service or NIS, this file may not be
# consulted at all; see /etc/host.conf for the resolution order.
#
# IPv4 and IPv6 localhost aliases
127.0.0.1 localhost
172.16.77.127 gameserv
:1 localhost
# Imaginary network.
#10.0.0.2 myname
#10.0.0.3 myfriend
#
# According to RFC 1918, you can use the following IP networks for private
# nets which will never be connected to the Internet:
#
# 10.0.0.0 - 10.255.255.255
# 172.16.0.0 - 172.31.255.255
# 192.168.0.0 - 192.168.255.255
#
# In case you want to be able to connect directly to the Internet (i.e. not
# behind a NAT, ADSL router, etc...), you need real official assigned
# numbers. Do not try to invent your own network numbers but instead get one
# from your network provider (if any) or from your regional registry (ARIN,
# APNIC, LACNIC, RIPE NCC, or AfriNIC.)
Вариант 1 -
Вариант 1 - погуглить
Вариант 2 - поправить конфиг:
ee /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock
[mysql.server]
user=mysql
basedir=/usr/local/mysql
[client]
socket=/var/lib/mysql/mysql.sock
Варинт 3 - сделать то, что оно хочет:
cd /usr/local/mysql && chown -R mysql:mysql data
cd /tmp && touch mysql.sock; chmod +x mysql.sock;
cd /usr/local/sbin/; ./mysqld_safe &