mysql 安装错误:FATAL ERROR: Neither host '* nor 'localhost' could be looked up with /usr/bin/resolveip

本文介绍了在使用mysql_install_db命令安装MySQL系统表时遇到的错误及其解决方案。通过配置hostname命令返回正确的主机名或使用–force选项可以解决主机名解析问题。此外,通过指定–datadir参数设置数据目录路径,可以成功完成MySQL的安装过程。

1、采用命令 mysql_install_db –user=mysql 安装时报错
$ sudo ./scripts/mysql_install_db –user=mysql

FATAL ERROR: Neither host ‘liminpc’ 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

2.命令增加 –datadir=/usr/local/mysql/data,启动成功

sudo ./scripts/mysql_install_db –user=mysql –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data –skip-name-resolve

**@****pc:/usr/local/mysql$ sudo ./scripts/mysql_install_db –user=mysql –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data –skip-name-resolve
Installing MySQL system tables…2015-08-24 10:55:19 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2015-08-24 10:55:19 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2015-08-24 10:55:19 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.25-enterprise-commercial-advanced) starting as process 3319 …
2015-08-24 10:55:19 3319 [Warning] Using pre 5.5 semantics to load error messages from /usr/share/mysql/.
2015-08-24 10:55:19 3319 [Warning] If this is not intended, refer to the documentation for valid usage of –lc-messages-dir and –language parameters.
OK

Filling help tables…2015-08-24 10:55:26 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2015-08-24 10:55:26 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2015-08-24 10:55:26 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.25-enterprise-commercial-advanced) starting as process 3356 …
2015-08-24 10:55:26 3356 [Warning] Using pre 5.5 semantics to load error messages from /usr/share/mysql/.
2015-08-24 10:55:26 3356 [Warning] If this is not intended, refer to the documentation for valid usage of –lc-messages-dir and –language parameters.
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/mysql/bin/mysqladmin -u root password ‘new-password’
/usr/local/mysql/bin/mysqladmin -u root -h 192.168.1.159 password ‘new-password’

Alternatively you can run:

/usr/local/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd . ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file /usr/local/mysql/my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used –defaults-file)
and when you later start the server.
The new default config file was created as /usr/local/mysql/my-new.cnf,
please compare it with your file and take the changes you need.

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
–defaults-file argument to mysqld_safe when starting the server

WARNING: Default config file /etc/mysql/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
–defaults-file argument to mysqld_safe when starting the server

sudo ./mysqld_safe –user=mysql –skip-grant-tables –skip-networking &

socket = /var/run/mysqld/mysql.sock

最后推荐一下,个人自营api数据平台,有各种各样数据,欢迎访问。www.yunshuda.cn 云数达

当在初始化 MySQL/MariaDB 数据库时出现 `FATAL ERROR: Could not find resolveip` 错误,可能是由于系统中缺少 `resolveip` 工具或者该工具的路径未被正确配置所导致。以下是一些可能的解决办法: ### 检查 `resolveip` 是否存在 可以使用以下命令检查系统中是否存在 `resolveip` 工具: ```bash which resolveip ``` 如果该命令没有输出,说明系统中可能没有安装 `resolveip`。 ### 安装 `resolveip` `resolveip` 通常是 MySQL 或 MariaDB 相关包的一部分。可以通过包管理器来安装: #### 在基于 Debian 或 Ubuntu 的系统上 使用 `apt` 命令进行安装: ```bash sudo apt-get update sudo apt-get install mariadb-client-core-<version> # 替换 <version> 为你的 MariaDB 版本 ``` #### 在基于 Red Hat 或 CentOS 的系统上 使用 `yum` 或 `dnf` 命令进行安装: ```bash sudo yum install mariadb -client # 对于 CentOS 7 及以下 sudo dnf install mariadb -client # 对于 CentOS 8 及以上 ``` ### 配置 `resolveip` 路径 如果 `resolveip` 已经安装,但 MySQL/MariaDB 仍然找不到它,可能需要将其所在目录添加到系统的 `PATH` 环境变量中。 首先,找到 `resolveip` 的安装路径: ```bash find / -name resolveip 2>/dev/null ``` 假设找到的路径是 `/usr/bin/resolveip`,可以将 `/usr/bin` 添加到 `PATH` 中: ```bash export PATH=$PATH:/usr/bin ``` 为了使该配置永久生效,可以将上述命令添加到 `~/.bashrc` 或 `/etc/profile` 文件中。 ### 重启服务 在完成上述操作后,尝试重新初始化 MySQL/MariaDB 数据库: ```bash mysql_install_db # 对于旧版本的 MySQL mysql_secure_installation # 对于 MySQL/MariaDB 安全初始化 ```
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值