Fedora mysql初始化出现问题及解决方案

mysql,在连接数据库的时候遇到了如下问题
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

因为还没有开启mysql服务
sudo service mysqld start

出现如下错误
初始化 MySQL 数据库: Neither host 'localhost.localdomain' nor 'localhost' could be looked up with

/usr/bin/resolveip
Please configure the 'hostname' command to return a correct hostname.
If you want to solve this at a later stage, restart this script with
the --force option

不知道localhost.localdomain和localhost是何物,这个问题我也早发现,以往在win下ping localhost,到linux下就不认识自己了。终于找到问题解决方案
sodu vi /etc/hosts

内容如下:
# Do not remove the following line, or various programs

# that require network functionality will fail.

::1 localhost.localdomain localhost

把::1修改成127.0.0.1就可以了(还是不要改成外网ip的好,毕竟哪天ip换了,又要麻烦一次)。