標籤:linux 資料庫 初始話失敗
在Linux系統中安裝MySQL,初始話失敗,報錯資訊如下:
WARNING: The host ‘Power1‘ could not be looked up with resolveip.This probably means that your libc libraries are not 100 % compatiblewith this binary MySQL version. The MySQL daemon, mysqld, should worknormally with the exception that host name resolving will not work.This means that you should use IP addresses instead of hostnameswhen specifying MySQL privileges !
1.從報錯資訊看,是資料庫無法解析機器名,排查過程如下:
使用resolveip查看IP是否正常
[[email protected] ~]# /usr/local/mysql/bin/resolveip Power1/usr/local/mysql/bin/resolveip: Unable to find hostid for ‘Power1‘: host not found
2.查看機器名
[[email protected] ~]# hostnamePower1
3.查看/etc/hosts檔案
[[email protected] ~]# cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
查詢結果可見/etc/hosts中無相應的機器名Power1
添ip(原生ip) 到機器的對應到/etc/hosts中,最終顯然如下:
[[email protected] ~]# cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.20.131 Power1
4.使用resolveip確認是否ok
[[email protected] ~]# /usr/local/mysql/bin/resolveip Power1IP address of Power1 is 192.168.20.131
5.重新初始化
Linux下安裝MySQL初始化失敗原因分析