Error ./bin/my_print_defaults: not found

starive發表於2014-11-05

scripts/mysql_install_db: 1: scripts/mysql_install_db: ./bin/my_print_defaults: not found
Neither host 'ubuntu' nor 'localhost' could be looked up with
./bin/resolveip


安裝MySQL

本人在Ubuntu12.04下安裝了mysql5.5.39,安裝步驟如下,到第 5 步就出bug了,

1:
在/home/*****下建立資料夾mysql:
/home/*****/mysql,

2
/home/*****/mysql/mysql-5.5.39,把壓縮包解壓到mysql-5.5.39資料夾下,如下圖:

3
sudo groupadd mysql
sudo useradd -r -g mysql mysql

4
sudo chown -R mysql:mysql /home/*****/mysql/mysql-5.5.39-linux2.6-i686

5
cd /home/*****/mysql/mysql-5.5.39-linux2.6-i686
sudo scripts/mysql_install_db –user=mysql

error資訊如下
root@ubuntu:/home/*****/mysql/mysql-5.5.39-linux2.6-i686# scripts/mysql_install_db --user=mysql
scripts/mysql_install_db: 1: scripts/mysql_install_db: ./bin/my_print_defaults: not found
Neither host 'ubuntu' nor 'localhost' could be looked up with
./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
root@ubuntu:/home/*****/mysql/mysql-5.5.39-linux2.6-i686# 


安裝cluster

本人下載了MySQL cluster 7.3.7 (下載地址:http://dev.mysql.com/downloads/cluster/) 二進位制版本。本人蔘考部落格:http://blog.itpub.net/26230597/viewspace-1087713/ 進行安裝,目前已經在管理節點和資料節點安裝好了Cluster。但是在 SQL節點上安裝Cluster就出現了問題。


SQL 節點安裝步驟如下:
解壓檔案
shell>tar -zxvf mysql-cluster-gpl-7.3.7-linux-glibc2.5-i686.tar.gz


拷貝安裝檔案
shell>mv /home/David/cluster/mysql-cluster-gpl-7.3.7-linux2.6-x86_64  /usr/local/mysql

新增mysql使用者
shell>groupadd  mysql
shell>useradd -g mysql mysql

新增許可權
shell>chown -R mysql:mysql /usr/local/mysql

拷貝配置檔案
shell>cp /usr/local/mysql/support-files/my-default.cnf  /etc/my.cnf


初始化資料庫
shell>cd /usr/local/mysql
shell>scripts/mysql_install_db --user=mysql

報錯:
sh: 1: ./bin/my_print_defaults: not found
FATAL ERROR: Neither host 'ubuntu' nor 'localhost' could be looked up with
./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 


本人採用瞭如下方法來解決:
解決方法1
檢視 /etc/hosts, 其內容如下:
127.0.0.1 localhost
127.0.1.1 ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

127.0.0.1 localhost,localhost.localdomain
172.3.200.159 localhost,localhost.locqaldomain

完全符合網上所說“要新增 127.0.0.1 localhost到/etc/hosts檔案中“。最後一行”172.3.200.159“是本人的ip地址。



解決方法2
修改 ~/.bashrc檔案的內容:

vi ~/.bashrc
export PATH=/usr/local/mysql/binPATH
source ~/.bashrc
重新啟動機器,重新執行命令:scripts/mysql_install_db --user=mysql  
出現瞭如下錯誤:
FATAL ERROR: Could not find ./bin/my_print_defaults
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

又參考網頁: http://blog.sina.com.cn/s/blog_546cc4350101g1pj.html
執行命令:/usr/local/mysql/scripts/mysql_install_db –user=mysql –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data &

又出現error:  
root@ubuntu:/usr/local/mysql/bin# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data & 
[1] 2264
root@ubuntu:/usr/local/mysql/bin# sh: 1: /usr/local/mysql/bin/my_print_defaults: not found
FATAL ERROR: Neither host 'ubuntu' nor 'localhost' could be looked up with
/usr/local/mysql/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


採用以上兩種方法,仍然無法解決問題,到底該如何解決了???

本人仔細看了部落格http://blog.itpub.net/26230597/viewspace-1087713/的安裝方法,和部落格的方法只有以下兩個區別:
區別:
部落格是 mysql-cluster-gpl-7.2.4-linux2.6-x86_64.tar.gz
我的是 mysql-cluster-gpl-7.3.7-linux-glibc2.5-i686.tar.gz
一個64位,一個32位
部落格的是 linux2.6, 我的是linux-glibc2.5




安裝MySQL和Cluster出現的問題一模一樣
其實,這個問題在這臺機器(後面簡稱主機C)上不是第一次出現了。因為我要搭建mysql叢集,所以首先在 三臺機器上面都安裝上了mysql。不過安裝環境有區別: 主機A的環境是:Win7下的VirtualBox + Ubuntu + MySQL, 主機B的環境是:Win7下的VirtualBox + Ubuntu + MySQL, 主機C的環境是:Ubuntu系統 + MySQL。主機C的系統直接在機器上面安裝的,不是虛擬環境,安裝方法:wubi安裝。

最開始在三臺主機分別安裝MySQL時,主機A和主機B都能順利安裝,但是主機C上面安裝有問題,出現的問題跟現在搭建cluster的問題一模一樣(詳見我釋出的帖子:http://www.itpub.net/thread-1894039-1-1.html

為什麼每次在主機C上面執行 scripts/mysql_install_db --user=mysql, 都會出現這種錯誤了,難道是因為我直接安裝Ubuntu的原因嗎,還是Wubi安裝帶來的bug??? 這個難題都困惱半個月了,在stackoverflow,itpub和csdn上面都沒有人能解答???




來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26435490/viewspace-1320844/,如需轉載,請註明出處,否則將追究法律責任。

相關文章