在幸狐RV1106板子上用gcc14.2本地编译安装mysql-8.0.42数据库

工作目录:
mkdir -p ~/software/mysql
cd ~/software/mysql

August 4, 2023
EOL of 32-bit Software for MySQL 8.1+.
Starting with MySQL 8.1 and future releases, only 64-bit binaries will be provided. Existing MySQL 8.0 will continue to provide 32-bit and 64-bit binaries for supported platforms until EOL in April 2026.

mysql-8.4.5和mysql-9.3.0不支持32位的linux系统,只支持64位的linux系统。
CMake Error at CMakeLists.txt:689 (MESSAGE):
  MySQL supports only 64-bit platforms.
rv1106g3是32位的arm芯片,所以只能运行32位的mysql数据库,最高只能运行8.0.x版本。

在fedora42虚拟机上用arm-gnu-toolchain-14.2交叉编译器编译gcc14.2、gdb14.2和make4.4,得到gcc本地编译器,然后在幸狐rv1106开发板上运行_rv1106 glibc-CSDN博客文章浏览阅读833次,点赞18次,收藏14次。如果不设置C_INCLUDE_PATH=/usr/include的话,#include 包含的是/usr/local/lib/gcc/arm-none-linux-gnueabihf/14.2.0/include/limits.h这个文件,里面#define MB_LEN_MAX 1,会导致很多软件包无法正常编译。交叉编译器下载地址:https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads/14-2-rel1。_rv1106 glibc https://blog.csdn.net/ZLK1214/article/details/149076762?spm=1011.2415.3001.5331【编译安装cyrus-sasl-2.1.28】

wget https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-2.1.28/cyrus-sasl-2.1.28.tar.gz --no-check-certificate
tar xf cyrus-sasl-2.1.28.tar.gz
cd cyrus-sasl-2.1.28
./configure
修改lib/saslutil.c和plugins/cram.c文件,在顶部添加#include <time.h>
make
make install
ldconfig
cd ..

【编译安装groff-1.23.0】

wget http://ftp.gnu.org/gnu/groff/groff-1.23.0.tar.gz --no-check-certificate
tar xf groff-1.23.0.tar.gz
cd groff-1.23.0
./configure
make
make install
ldconfig
cd ..

【编译安装openldap-2.6.10】

wget https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-2.6.10.tgz --no-check-certificate
tar xf openldap-2.6.10.tgz
cd openldap-2.6.10
./configure
make
make install
ldconfig
cd ..

【编译安装krb5-1.21.3】

wget https://kerberos.org/dist/krb5/1.21/krb5-1.21.3.tar.gz --no-check-certificate
tar xf krb5-1.21.3.tar.gz
cd krb5-1.21.3/src
./configure
make
make install
ldconfig
cd ../..

【编译安装libtirpc-1.3.6】

wget https://zenlayer.dl.sourceforge.net/project/libtirpc/libtirpc/1.3.6/libtirpc-1.3.6.tar.bz2 --no-check-certificate
tar xf libtirpc-1.3.6.tar.bz2
cd libtirpc-1.3.6
./configure
make
make install
ldconfig
cd ..

【编译安装rpcsvc-proto-1.4.4】

wget https://github.com/thkukuk/rpcsvc-proto/releases/download/v1.4.4/rpcsvc-proto-1.4.4.tar.xz --no-check-certificate
tar xf rpcsvc-proto-1.4.4.tar.xz
cd rpcsvc-proto-1.4.4
./configure
make
make install
ldconfig
cd ..

【编译安装mysql-8.0.42(自带boost库)】
在幸狐rv1106g3板子上编译mysql数据库大约要花四天三夜的时间。
第一天编译了14个小时,第二天、第三天每天都编译了24个小时,第四天编译了16个小时,一共花了78个小时。

wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.42.tar.gz --no-check-certificate
mkdir mysql
cd mysql
tar xf ../mysql-boost-8.0.42.tar.gz
mkdir _build
cd _build
cmake ../mysql-8.0.42 -DWITH_BOOST=../mysql-8.0.42/boost/boost_1_77_0 -DWITH_UNIT_TESTS=OFF
swapon /root/swapfile
make
make install
swapoff /root/swapfile
ldconfig
cd ../..

提示:
(1) 如果板子上没有装libncurses.so,只装了libncursesw.so,那么cmake命令还需要指定-DCURSES_LIBRARY=/usr/lib/libncursesw.so选项。
(2) mysql-boost-8.0.42.tar.gz压缩包自带boost库的头文件,不需要单独下载boost库,更不需要在板子上编译安装boost库
    mysql只是在编译过程中要用到boost库的头文件,编译一完成,boost库就没用了。
(3) -DWITH_UNIT_TESTS=OFF这个选项非常重要,否则会浪费大量的时间编译出一堆无用的单元测试程序。
(4) 如果编译期间板子断过电或者异常重启过的话,编译完成后最好用find . -name "*.o" -empty命令看看有没有没编译出来的空白o文件。如果有的话把这些空白o文件删了,重新make编译一下这些文件,再make install。
     空白o文件生成的a库和so库文件是不完整的,会缺少某些函数和类,以后编译其他软件包的话可能会报undefined reference错误。
(5) 编译前必须正确设置C_INCLUDE_PATH和CPLUS_INCLUDE_PATH环境变量,确保gcc和g++能正常工作。
export C_INCLUDE_PATH=/usr/include
export CPLUS_INCLUDE_PATH=/usr/local/include/c++/14.2.0:/usr/include

【关于mysql abi_check失败的问题】
[root@luckfox-rv1106 ~/software/mysql/mysql/_build]# make
[  0%] Generating abi_check.out
--- /root/software/mysql/mysql/mysql-8.0.42/include/mysql/services.h.pp
+++ /root/software/mysql/mysql/_build/abi_check.out
...
CMake Error at /root/software/mysql/mysql/mysql-8.0.42/cmake/do_abi_check.cmake:122 (MESSAGE):
  ABI check found difference between
  /root/software/mysql/mysql/mysql-8.0.42/include/mysql/services.h.pp and
  /root/software/mysql/mysql/_build/abi_check.out


make[2]: *** [CMakeFiles/abi_check.dir/build.make:116: abi_check.out] Error 1
make[2]: *** Deleting file 'abi_check.out'
make[1]: *** [CMakeFiles/Makefile2:5610: CMakeFiles/abi_check.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
[root@luckfox-rv1106 ~/software/mysql/mysql/_build]#
解决办法:
修改../mysql-8.0.42/cmake/do_abi_check.cmake文件的第122行,把MESSAGE(FATAL_ERROR改成MESSAGE(WARNING。
  IF(NOT ${result} EQUAL 0)
    MESSAGE(WARNING
      "ABI check found difference between ${file}.pp and ${abi_check_out}")
  ENDIF()
注意修改的这个cmake文件位于mysql-8.0.42源码目录,而非存放编译文件用的_build目录。

【配置mysql数据库】
添加mysql用户和组:
(系统用户,且不可登录。-S表示编号从100开始)
addgroup -S mysql
adduser -G mysql -SDH mysql

初始化mysql数据库:
cd /usr/local/mysql
bin/mysqld --initialize --user=mysql
cd ~
初始化完成后会产生/usr/local/mysql/data文件夹。
注意随机生成的root密码([Note] [MY-010454] [Server] A temporary password is generated for root@localhost)。

启动mysql数据库服务器(必须打开swapfile交换文件,否则内存不够,无法启动数据库服务器):
swapon /root/swapfile
/usr/local/mysql/bin/mysqld_safe --user=mysql &
命令执行完成后进程转入后台,立即返回,不用等,可以继续在命令行中输入其他命令。

进行一些其他的配置:
/usr/local/mysql/bin/mysql_secure_installation

[root@luckfox-rv1106 ~]# /usr/local/mysql/bin/mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root:

The existing password for the user account root has expired. Please set a new password.

New password:

Re-enter new password:

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: n
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!
[root@luckfox-rv1106 ~]#

进入数据库:
/usr/local/mysql/bin/mysql -u root -p

[root@luckfox-rv1106 ~]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.42 Source distribution

Copyright (c) 2000, 2025, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.12 sec)

mysql> exit
Bye
[root@luckfox-rv1106 ~]# /usr/local/mysql/bin/mysql --version
/usr/local/mysql/bin/mysql  Ver 8.0.42 for Linux on armv7l (Source distribution)
[root@luckfox-rv1106 ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:         215.1M      167.5M        3.7M       44.0K       43.9M       40.7M
Swap:          2.0G      200.5M        1.8G
[root@luckfox-rv1106 ~]#

mysql服务器的内存占用还是挺大的,rv1106g3片内的256MB内存是不够用的,必须要设置swapfile交换文件。

关闭mysql数据库服务器:
/usr/local/mysql/bin/mysqladmin shutdown -u root -p

【安装phpMyAdmin-3.3.10】

去这里面下载phpMyAdmin-3.3.10-for-php8.4:
https://github.com/zlk12142/phpMyAdmin-3.3.10-for-php8.4
phpMyAdmin-3.3.10支持XP系统的IE6浏览器,这是修改后的能在php8.4上运行的版本。

cd ~
wget https://github.com/zlk12142/phpMyAdmin-3.3.10-for-php8.4/archive/refs/heads/main.zip --no-check-certificate
unzip main.zip -d /opt/httpd-2.4.63/htdocs
mv /opt/httpd-2.4.63/htdocs/phpMyAdmin-3.3.10-for-php8.4-main /opt/httpd-2.4.63/htdocs/phpMyAdmin

改下php里面的超时时间,不然容易超时。
vi /opt/php-8.4.8/lib/php.ini
max_execution_time = 30改成120
memory_limit = 128M改成-1
重启apache服务器:/opt/httpd-2.4.63/bin/apachectl restart 

然后就可以通过https://板子IP/phpMyAdmin访问了。
不用管“无法加载 mcrypt (外链,英语) 扩展,请检查您的 PHP 配置。”这条消息,因为php从7.2开始就不支持mcrypt了。


在幸狐RV1106板子上用gcc14.2本地编译安装ssh客户端/服务器、vim编辑器、sl、vsftpd服务器和git客户端:https://blog.csdn.net/ZLK1214/article/details/149649227
在幸狐RV1106板子上用gcc14.2本地编译安装samba-4.22.3服务器:https://blog.csdn.net/ZLK1214/article/details/149814242 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

巨大八爪鱼

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

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

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

打赏作者

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

抵扣说明:

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

余额充值