我正在 *nix 机器上工作,但没有 root
权限。
我正在尝试使用此博文在本地安装 mysql:http://www.thedance.net/~roth/TECHBLOG/localMySQL.html
但是,我陷入了 scripts/mysql_install_db
命令。
当我运行此命令时,出现以下错误:
FATAL ERROR: Neither host 'server.address.com' 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
经过进一步挖掘,我发现添加 --basedir
可以解决此问题。但随后它会生成以下错误:
$scripts/mysql_install_db --basedir=.
Installing MySQL system tables...2015-07-17 01:38:15 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-07-17 01:38:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-07-17 01:38:15 0 [Note] ./bin/mysqld (mysqld 5.6.25) starting as process 10281 ...
2015-07-17 01:38:15 10281 [ERROR] Can't find messagefile '/usr/share/mysql/errmsg.sys'
2015-07-17 01:38:15 10281 [Warning] Can't create test file /var/lib/mysql/head.lower-test
2015-07-17 01:38:15 10281 [Warning] Can't create test file /var/lib/mysql/head.lower-test
./bin/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13 - Permission denied)
2015-07-17 01:38:15 10281 [ERROR] Aborting
2015-07-17 01:38:15 10281 [Note] Binlog end
2015-07-17 01:38:15 10281 [Note]
当我添加 --datadir=myDataDir
(其中 myDataDir 是本地目录)时,它会生成以下错误:
$scripts/mysql_install_db --basedir=. --datadir=myDataDir
Installing MySQL system tables...2015-07-17 01:40:54 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-07-17 01:40:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-07-17 01:40:54 0 [Note] ./bin/mysqld (mysqld 5.6.25) starting as process 10329 ...
2015-07-17 01:40:54 10329 [ERROR] Can't find messagefile '/usr/share/mysql/errmsg.sys'
它正在尝试访问系统级文件夹,但由于权限问题而失败。我如何在本地安装它。如何设置主机名?
最佳答案
问题出在日志中的以下行:
[ERROR] Can't find messagefile '/usr/share/mysql/errmsg.sys'
要解决这个问题,请将此标志添加到您的命令中:
--lc-messages-dir="/some/path/you/can/access/without/sudo/"
关于mysql本地安装mysql_install_db错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31467374/