mysql移植到 arm

一、源码下载
1、下载mysql源码
源码下载地址:选择版本:5.1.72(这是个老版本,高版本需要使用cmake)
https://cdn.mysql.com/archives/mysql-5.1/mysql-5.1.72.tar.gz
历史版本下载地址
源码官网地址,在Operating System中选择Source code
https://downloads.mysql.com/archives/community/

2、下载ncurses,选择5.9版本
官网地址
http://ftp.gnu.org/pub/gnu/ncurses/
下载地址
http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz

二、交叉编译

1、由于移植mysql库需要用到libncurses.a静态库,所以在移植mysql之前,我们需要先移植ncurses

tar zxvf ncurses-5.9.tar.gz

cd  ncurses-5.9
./configure CC=arm-linux-gnueabihf-gcc -host=arm-linux-gnueabihf -prefix=/root/mysql/ncurses -enable-static

make && make install

2、交叉 编译编译mysql前需要  PC安装下单sql文件夹中的 gen_lex_hash文件

编译PC下的Mysql

tar zxvf mysql-5.1.72

cd  mysql-5.1.72

./configure --prefix=/root/mysql/mysql

报错:/usr/lib/libncursesw.so.5: error adding symbols: File in wrong format

安装:sudo apt-get install libncurses5-dev

 make

 mv mysql-5.1.72  mysql-5.1.72-pc

不用安装

3、交叉 编译编译mysql

(1)、修改文件 gedit configure

共4处:这样的代码总共有四处,都要屏蔽掉,分别在26302,48120,48226,48439行

  if test "$cross_compiling" = yes; then {}
 # { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
#$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
#{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
#See \`config.log' for more details." >&5
#$as_echo "$as_me: error: cannot run test program while cross compiling
#See \`config.log' for more details." >&2;}
#  { (exit 1); exit 1; }; }; }
else

备注:在then后面加上 { }  把下面都注释掉

(2)、修改  configure 文件

(config.status: executing libtool commands

rm: cannot remove 'libtoolT': No such file or directory)

在配置文件中找到RM='$RM'这一行 修改为RM='$RM -f',

(3)sql_parse.cc:5504:21: error: operator '<' has no left operand

在sql_parse.cc文件5504行前面添加一行:  # define STACK_DIRECTION 1

(4)../include/my_config.h:1133:1: warning: "STACK_DIRECTION" redefined

/include/my_config.h    把my_config.h中的# define STACK_DIRECTION 后面增加 -1

    PACKAGE='$PACKAGE'
    VERSION='$VERSION'
    TIMESTAMP='$TIMESTAMP'
    RM='$RM -f'
    ofile='$ofile'

cd  mysql-5.1.72

./configure --host=arm-linux-gnueabihf --enable-static --with-named-curses-libs=/root/mysql/ncurses/lib/libncurses.a --prefix=/root/mysql/mysql --without-debug --without-docs --without-man --without-bench --with-charset=gb2312 --with-extra-charsets=ascii,latin1,utf8

(3)拷贝文件 把PC编译的文件sql/gen_lex_hash 、sql_parse.cc 拷贝到  交叉编译的 sql/ 文件夹下

make -j4

nake install

拷贝pc的/usr/local/mysql到开发板的相同目录

在开发板上执行:

设置环境变量或将/usr/local/mysql/bin 下面的可执行文件复制到/usr/sbin 目录下

# export PATH="$PATH:/usr/local/mysql/bin"

添加/etc/my.conf 配置文件

# vi /etc/my.conf

内容如下:

datadir=/var/lib/mysql

socket=/tmp/mysql.sock

user=root

#Default to using old password format for compatibility with mysql 3.x

#clients (those using the mysqlclient10 compatibility package).

old_passwords=1

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

因为在/var/run目录下没有mysqld/mysqld.pid,手工建立:

# mkdir /var/run/mysqld

# touch /var/run/mysqld/mysqld.pid

安装数据库:

#mysql_install_db -u root

启动mysql服务:

# mysqld_safe --user=root --skip-grant-tables --skip-networking &

# mysql
 

参考

arm linux mysql_移植mysql到arm平台

arm linux mysql_移植mysql到arm平台_陈冠男的博客-CSDN博客

bench mysql work_EK200移植mysql数据库

bench mysql work_EK200移植mysql数据库_weixin_39887748的博客-CSDN博客

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dodo_code

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值