一、源码下载
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、编译PC版的mysql备用
1.1 解压mysql-5.1.72.tar.gz后进入目录mysql-5.1.72中,执行:./configure -prefix=/usr/local/mysql
1.2 执行:make
1.3 复制mysql-5.1.72 为mysql-5.1.72_pc备份

2、交叉编译ncurses,注意路径是本人电脑环境的路径(/home/lisa/1-tools/install/ncurses-5.9),需要根据自己的做更改
2.1 解压ncurses-5.9.tar.gz后进入目录ncurses-5.9中,
执行:./configure --host=arm-fsl-linux-gnueabi --prefix=/usr/local/ncurse -enable-static
2.2 执行:make
2.3 进入root权限:su
2.4 配置环境变量PATH:根据自己电脑环境来配置
export PATH=$PATH:/home/lisa/1-tools/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/
2.5 执行:make install

3、交叉编译mysql
3.1 解压mysql-5.1.72.tar.gz后进入目录mysql-5.1.72中;
3.2 修改configure,共四处
3.2.1
----------------------------------------------------------------------------------------------
26302   if test "$cross_compiling" = yes; then
26303   echo "skip...!"
26304 #  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
26305 #$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
26306 #{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
26307 #See \`config.log' for more details." >&5
26308 #$as_echo "$as_me: error: cannot run test program while cross compiling
26309 #See \`config.log' for more details." >&2;}
26310 #   { (exit 1); exit 1; }; }; }
26311 else
-------------------------------------------------------------------------------------------------
3.2.2
-------------------------------------------------------------------------------------------------
48121   if test "$cross_compiling" = yes; then
48122   echo "skip...!"
48123 #  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
48124 #$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
48125 #{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
48126 #See \`config.log' for more details." >&5
48127 #$as_echo "$as_me: error: cannot run test program while cross compiling
48128 #See \`config.log' for more details." >&2;}
48129 #   { (exit 1); exit 1; }; }; }
48130 else
-------------------------------------------------------------------------------------------------
3.2.3
-------------------------------------------------------------------------------------------------
48228   if test "$cross_compiling" = yes; then
48229   echo "skip...!"
48230 # { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
48231 #$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
48232 #{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
48233 #See \`config.log' for more details." >&5
48234 #$as_echo "$as_me: error: cannot run test program while cross compiling
48235 #See \`config.log' for more details." >&2;}
48236 #   { (exit 1); exit 1; }; }; }
48237 else
-------------------------------------------------------------------------------------------------
3.2.4
-------------------------------------------------------------------------------------------------
48442   if test "$cross_compiling" = yes; then
48443   echo "skip...!"
48444 # { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
48445 #$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
48446 #{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
48447 #See \`config.log' for more details." >&5
48448 #$as_echo "$as_me: error: cannot run test program while cross compiling
48449 #See \`config.log' for more details." >&2;}
48450 #   { (exit 1); exit 1; }; }; }
48451 else
-------------------------------------------------------------------------------------------------

3.3 执行configue,注意:安装路径和引用ncurses-5.9库的路径,是本人电脑环境的路径,需要根据自己的做更改
./configure --host=arm-fsl-linux-gnueabi --enable-static --with-named-curses-libs=/usr/local/ncurse/lib/libncurses.a --prefix=/usr/local/mysql --without-debug --without-docs --without-man --without-bench --with-charset=gb2312 --with-extra-charsets=ascii,latin1,utf8
3.3.1 注意:configure -help中有如下编译选项,本次未添加,未验证:--with-embedded-server --with-machine-type

3.4 修改sql/sql_parse.cc,添加如下代码
-------------------------------------------------------------------------------------------------
5741 #define STACK_DIRECTION 1
-------------------------------------------------------------------------------------------------

3.5 将pc版中gen_lex_hash文件到当前文件夹
$cp  ../mysql-5.1.72_pc/sql/gen_lex_hash sql/
$touch –m sql/gen_lex_hash  
$cp  ../mysql-5.1.72_pc/sql/lex_hash.h sql/
$touch –m sql/lex_hash.h

3.6 make
3.7 进入root权限:su
3.8 配置环境变量PATH:根据自己电脑环境来配置
export PATH=$PATH:/home/lisa/1-tools/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/
3.9 执行:make install

三、移植到arm平台
1、将库拷贝到开发板上
$ cd /usr/local/
$ sudo tar -zcvf mysql-arm-5.1.72.tar.gz mysql/
将mysql-arm-5.1.72.tar.gz拷贝到开发板上,解压到/usr/local下:tar -xf mysql-arm-5.1.72.tar.gz -C /usr/local

2、配置环境变量
修改/etc/profile,在文件添加:
-------------------------------------------------------------------------------------------------
export PATH="$PATH:/usr/local/mysql/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/mysql/lib/mysql"
-------------------------------------------------------------------------------------------------

3、创建配置文件 /etc/my.cnf
添加内容如下:
-------------------------------------------------------------------------------------------------
[client]
port = 3306
socket = /tmp/mysql.sock

[mysqld]
port = 3306
datadir=/var/lib/mysql
socket=/tmp/mysql.sock
user=root  
old_passwords=1
skip-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout
-------------------------------------------------------------------------------------------------

4、安装mysql数据
#mkdir -p /var/run/mysqld/
#mkdir -p /var/log/
#touch /var/run/mysqld/mysqld.pid
#mysql_install_db --user=root --force --basedir=/usr/local/mysql --datadir=/var/lib/mysql

5、添加启动文件
将源码中的启动文件:拷贝support-files/mysql.server,为/etc/init.d/mysqld
修改mysql.server内容:
-------------------------------------------------------------------------------------------------
     basedir=/usr/local/mysql
     datadir=/var/lib/mysql

pid_file=/var/run/mysqld/mysqld.pid
     server_pid_file=/var/run/mysqld/mysqld.pid
-------------------------------------------------------------------------------------------------

6、重启开发板

四、使用mysql
1、初始化mysql数据库
 mysql_install_db --user=root --force --basedir=/usr/local/mysql --datadir=/var/lib/mysql
-------------------------------------------------------------------------------------------------
root@freescale ~$ mysql_install_db --user=root --force --basedir=/usr/local/mysql --datadir=/var/lib/mysql
Installing MySQL system tables...
170612 14:25:55 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
Filling help tables...
170612 14:25:55 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h freescale password 'new-password'

Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/mysql/scripts/mysqlbug script!
-------------------------------------------------------------------------------------------------

2、启动mysql数据库
/etc/init.d/mysqld start

3、访问mysql
mysql -u root
mysql>use mysql
mysql>show tables;

【数据库】mysql移植相关推荐

  1. 嵌入式数据库mysql移植_移植MySQL到嵌入式ARM平台

    参考博文:http://www.cnblogs.com/Charles-Zhang-Blog/p/3529980.html 一:开发环境 主机开发环境:VMWARE下安装的UBUNTU 10.04 g ...

  2. 安装memsql与将数据库从 MySQL 移植到 MemSQL

    安装memsql 安装挺简单的,所谓的安装其实就是解压缩二进制包,然后检查下环境就o了,步骤如官网页面所示: $ wget http://download.memsql.com/814d3816f40 ...

  3. access 数据库 mysql数据库_如何将Access数据库移植到MySQL数据库

    序论 很多MySQL用户都有过将Access移植到MySQL的计划,不过这个移植过程性能和实践的相关描述资料很少.本文将为大家总结将Access应用程序成功移植到MySQL的要点和注意事项. 由于Ac ...

  4. 金仓数据库 MySQL 至 KingbaseES 迁移最佳实践(3. MySQL 数据库移植实战)

    3. MySQL 数据库移植实战 由于 KingbaseES 利用 KDTS-PLUS 等多种工具简化移植过程. 本节重点描述了在实际应用中移植一个 MySQL 数据库系统的完整过程,以及其中的主要移 ...

  5. 主键由数据库mysql 映射native_Hibernate主键生成策略详解

    转载自:http://blog.csdn.net/wanghuan203/article/details/7562395 hibernate提供的主键生成策略,使我们可以在实体类的映射xml文件中设定 ...

  6. 数据库mysql性能优化-学习笔记

    数据库mysql性能优化 1. 数据库设计范式 2. 常见关系数据库 3. MySQL 的版本 4. mysql存储计划 5 . mysql查询配置 和 设置配置 6 . mysql基本参数 7 .m ...

  7. 云数据库 MySQL使用规范 数据库开发人员一定要看!

    规范化对云数据库 MySQL 的管理和维护,避免操作不当对云数据库 MySQL 造成不可用等影响.指导数据库开发人员合理编写 SQL,发挥云数据库 MySQL 最优性能. 权限管理规范 考虑到云数据库 ...

  8. lua mysql 事务_Lua 操作数据库(MySQL)

    Lua 操作数据库(MySQL) 对于简单的数据操作,我们可以使用文件,但是,有时这些文件操作可能效率不高.可扩展性和功能不够强大.为此,我们通常会切换到数据库.LuaSQL提供从Lua到数据库管理系 ...

  9. linux笔记本没有insert,无法在Linux中将UTF8插入数据库MySQL(Can not insert UTF8 to Database MySQL in Linux)...

    无法在Linux中将UTF8插入数据库MySQL(Can not insert UTF8 to Database MySQL in Linux) 当创建表时,我已经设置了charset = utf8. ...

  10. 数据库MYSQL学习系列三

    数据库MYSQL学习系列三 三.MYSQL事务与存储引擎 3.1-数据库事务 什么是事务 一系列有序的数据库操作: o要么全部成功 o要么全部回退到操作前的状态 o中间状态对其他连接不可见 事务的 ...

最新文章

  1. Simulink仿真 离散系统仿真
  2. 华南理工大学网络教育计算机答案,计算机电路基础·随堂练习2019春华南理工大学网络教育答案.doc...
  3. Oracle 发布基于 VS Code 的开发者工具,轻松连接 Oracle 数据库
  4. NB-IoT---(0) NB-IoT技术
  5. 深度学习-吴恩达-笔记-1-深度学习引言
  6. 【ctags/cscope/project安装使用】给神编辑器vim添加新的翅膀
  7. quick code ide设置分辨率
  8. android mat分析,android内存泄露MAT分析心得与注意点
  9. 利用 openresty balancer_by_lua 实现一个简单的 ip_hash upstream 调度
  10. 佳铁精雕机连接电脑设置_佳铁精雕机在程式里怎么更改G57之后的坐标
  11. CCA分析图如何解读_BI报表控件Wyn使用教程:如何使用网状/雷达图进行数据分析...
  12. 人工智能如何被用于造福人类?
  13. html标签加载状态,如何让html页面数据没有加载完前显示loading加载中
  14. xp系统无法自动修复此计算机该怎么解决,WinXP不能正常启动的修复方法
  15. 本地电脑安装虚拟机-解决USB驱动报错(代码 39)问题
  16. html base64在线解码,HTML5原生支持Base64编码解码
  17. 计算机课 - 计算机科学导论
  18. 手把手教你:基于LSTM的股票预测系统
  19. 用原生js+html写一个像素鸟游戏
  20. Acwing:通电围栏(皮克定理)

热门文章

  1. 【目标检测】(5) YOLOV1 目标检测原理解析
  2. 【机器学习入门】(13) 实战:心脏病预测,补充: ROC曲线、精确率--召回率曲线,附python完整代码和数据集
  3. excel公式编辑器_职场办公技巧—Word公式编辑器怎么用
  4. 剑指offer:面试题17. 打印从1到最大的n位数
  5. 每日起床前做这五个动作,可保障你终身不感冒——奥运福娃设计师韩美林老师亲测可用
  6. 关于在linux下清屏的几种技巧
  7. C++的 STL堆 实现获取中位数
  8. Andorid自定义attr的各种坑
  9. eclipse 变成中文
  10. [SCOI2007]修车