Error ./bin/my_print_defaults: not found

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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26435490/viewspace-1320844/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值