在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是否正常
[[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] ~]# hostname Power1
3.查看/etc/hosts文件
[[email protected] ~]# 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中,最终显然如下:
[[email protected] ~]# 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
[[email protected] ~]# /usr/local/mysql/bin/resolveip Power1 IP address of Power1 is 192.168.20.131
5.重新初始化
时间: 2024-09-30 14:29:35