Linux下安裝MySQL初始化失敗原因分析

在Linux系統中安裝MySQL,初始話失敗,報錯信息如下:

WARNING: The host 'Power1' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !

1.從報錯信息看,是數據庫無法解析機器名,排查過程如下:

    使用resolveip查看IP是否正常

[root@Power1 ~]# /usr/local/mysql/bin/resolveip Power1
/usr/local/mysql/bin/resolveip: Unable to find hostid for 'Power1': host not found


2.查看機器名

[root@Power1 ~]# hostname
Power1


3.查看/etc/hosts文件

[root@Power1 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

查詢結果可見/etc/hosts中無相應的機器名Power1

添ip(本機的ip) 到機器的對應到/etc/hosts中,最終顯然如下:

[root@Power1 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.20.131 Power1

4.使用resolveip確認是否ok

[root@Power1 ~]# /usr/local/mysql/bin/resolveip Power1
IP address of Power1 is 192.168.20.131

5.重新初始化


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章