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

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 云数达

<think>好的,我需要帮助用户解决Termux中MariaDB二进制文件路径错误的问题。错误信息显示“Could notfind /data/data/com.termux/files/usr//data/data/com.termux/files/usr/bin/mari”,看起来路径重复了。这可能是因为配置文件中设置的路径有误,或者安装过程中某些步骤出错了。首先,我应该确认MariaDB在Termux中的正确安装路径。Termux的默认安装路径通常是/data/data/com.termux/files/usr/bin/,所以正确的二进制文件应该是mariadb或mysql。用户提到的路径中有重复的部分,可能是配置文件中错误地拼接了路径,导致系统在寻找二进制文件时访问了错误的路径。 接下来,我需要检查MariaDB的配置文件,比如my.cnf,看看里面的basedir或bindir参数是否正确。如果这些参数被错误地设置成了重复的路径,就需要手动修改它们。此外,用户可能使用了错误安装脚本,或者安装过程中环境变量没有正确设置,导致路径被错误地追加。另外,用户可能尝试过手动指定路径,但命令中存在拼写错误或者参数顺序问题。例如,在初始化数据库时,如果--basedir或--datadir参数设置不正确,就会导致路径错误。这时候需要指导用户正确使用mysql_install_db脚本,并确保参数准确无误。如果以上方法都无法解决问题,可能需要重新安装MariaDB,并确保在安装过程中Termux的环境变量和路径配置正确。Termux的包管理器pkg通常会处理好这些路径,但有时候手动安装或第三方脚本可能会引发问题。因此,建议用户优先使用pkginstall mariadb来安装,避免手动编译或从其他来源获取安装包。最后,生成相关问题可以帮助用户进一步排查可能遇到的同类问题,比如如何配置MariaDB的环境变量,或者如何修复数据库初始化失败的情况。这些问题能够覆盖用户在处理路径错误时可能遇到的其他障碍,提供更全面的支持。</think>### Termux中MariaDB二进制文件路径错误解决方案 #### 问题分析 错误提示`Could not find /data/data/com.termux/files/usr//data/data/com.termux/files/usr/bin/mari`表明路径重复拼接,通常由以下原因导致: 1. **配置参数错误**:MariaDB的`my.cnf`文件中`basedir`或`bindir`参数被错误覆盖[^1] 2. **安装脚本缺陷**:手动安装时环境变量未正确传递 3. **符号链接丢失**:关键二进制文件未正确链接 #### 解决步骤 1. **验证默认安装路径** ```bash pkg install mariadb -y ls /data/data/com.termux/files/usr/bin/mariadb* ``` 正确路径应为`/data/data/com.termux/files/usr/bin/mariadb` 2. **修正配置文件** ```bash nano $PREFIX/etc/my.cnf ``` 检查并修改以下参数: ```ini [mysqld] basedir = /data/data/com.termux/files/usr bindir = /data/data/com.termux/files/usr/bin ``` 3. **重建符号链接** ```bash ln -sf $PREFIX/bin/mariadb $PREFIX/bin/mysql ln -sf $PREFIX/bin/mariadb-dump $PREFIX/bin/mysqldump ``` 4. **重新初始化数据库** ```bash mysql_install_db --user=mysql \ --basedir=$PREFIX \ --datadir=$PREFIX/var/lib/mysql ``` #### 验证修复 ```bash mysqld_safe --datadir=$PREFIX/var/lib/mysql & mysqladmin version ``` #### 典型错误示例修正对比 | 错误配置路径 | 修正后路径 | |--------------|------------| | `/data/data/com.termux/files/usr//data/...` | `$PREFIX/bin/mariadb` | | `usr/bin/mariadb` | `/data/data/com.termux/files/usr/bin/mariadb` |
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值