mysql本地安装mysql_install_db错误

我正在使用* nix机器,而我没有root权限。

我想在本地安装mysql使用这个blogpost: 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 

在进一步的挖掘中,我发现join--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' 

它试图访问系统级别的文件夹,并由于权限问题,它是失败的。 我如何在本地安装 我如何设置主机名?

查找可能包含以下行的my.cnfconfiguration文件:

 lc-messages-dir = /usr/share/mysql 

正如你所说,由于你当前的权限,mysql不能访问这个标准的configuration文件。

两种可能的解决方

  1. 将此参数更改为可访问的目录,并将您的configuration文件传递给mysql_install_db

    $ ./scripts/mysql_install_db --defaults-file=my.cnf --basedir=. --datadir=myDataDir

  2. 使用–no-defaults来防止读取其他configuration文件

    $ ./scripts/mysql_install_db --no-defaults --basedir=. --datadir=myDataDir