我已在我的计算机上安装了Lampp,该计算机在OpenSuse 13.1上运行。问题是我无法从主机名' localhost '访问mysql,但可以通过主机名' localhost:3306 '或' 127.0.0.1访问它”。那太奇怪了!这真的搞砸了我的项目。伙计们有没有办法从主机名localhost访问mysql? 提前谢谢!
这是我的主机文件:
127.0.0.1 localhost
# special IPv6 addresses
::1 localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
127.0.0.1 HOME-PC.home # added by Apache Friends XAMPP
127.0.0.1 HOME-PC # added by Apache Friends XAMPP
和我的/opt/lampp/etc/my.cnf文件:
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /opt/lampp/var/mysql/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
user = mysql
port=3306
socket = /opt/lampp/var/mysql/mysql.sock
skip-external-locking
key_buffer = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
# Where do all the plugins live
plugin_dir = /opt/lampp/lib/mysql/plugin/