移植mysql到tiny6410并附带怎么使6410跑mysql设置

来源:互联网 发布:网络电视直播软件安装 编辑:程序博客网 时间:2024/05/16 23:37

系统:UBUNTU      编译器:4.5.1      mysql源码:5.1.66    

移植过程完全按照《Ubuntu下编译ARM平台QtEmbedded的MySQL和MySQL插件》一文所述步骤。最终把/usr/local/mysql  拷贝到arm板的/usr/local/下。接下来就是与意志过程无关的mysql设置过程了。《Ubuntu下编译ARM平台QtEmbedded的MySQL和MySQL插件》文中并没有写怎么设置mysql,参考百度文库文章:《编译ARM平台的 QTEmbedded的Mysql插件和移植MySql到ARM开发板》中的移植过程中对mysql的设置如下。

vi /etc/mycnf  复制如下内容

[mysqld]
#datadir=/var/lib/mysql
datadir = /work/data/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/lib/mysql/FriendlyARM.pid


运行mysql -V可以显示mysql的版本。但是运行mysql_install_db -uroot 出现如下错误:Neither host 'FriendlyARM' 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

接下来运行mysql_install_db -uroot --force

出现:Installing MySQL system tables...
OK
Filling help tables...
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 FriendlyARM 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/bin/mysqlbug script!

再运行mysql出现:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

 (2)查看出错原因是因为mysql没有启动,可是发现/etc/ini.d/下没有关于mysql的启动文件。

于是网上查找执行:copy /usr/local/mysql/share/mysql/mysql.server  /etc/init.d/mysql.server ,执行/etc/init.d/mysql.server start出现:启动错误,后来查找日志文件/var/log/mysqld.log发现里面有个FrinendlyARM.pid并不是/etc/myconf里面的/var/run/mysqld/mysqld.pid 于是自己注释这行并改为pid-file=/var/lib/mysql/FriendlyARM.pid,并且执行 touch   /var/lib/mysql/FriendlyARM.pid创建文件。

(3)另外在由于拷贝mysql到arm上的时候没有拷贝链接文件,所以启动mysql.server的时候出错mysql: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory

解决方法1、在/etc/ld.so.conf里面加入下面2行:
/usr/local/mysql/lib/mysql
/usr/local/lib
然后用ldconfig重新加载下库文件,但是我发现仍然不能解决问题,不知道是我环境的问题还是其他问题.
2、使用软连接:
我发现提示错误找不到 error while loading shared libraries: /usr/local/mysql/lib/mysql/libmysqlclient.so.16,但是目录下没有这个文件,只有/usr/local/mysql/lib/libmysqlclient.so.16.0.0 于是建立软连接
ln -s /usr/local/mysql/lib/libmysqlclient.so.16.0.0/usr/local/mysql/lib/libmysqlclient.so.16

顺便也建立

ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16



这里的/usr/local/mysql/lib/libmysqlclient.so.16,要根据自己的实际情况去改变

然后在用snort命令就没有出现以上的错误了.

(3)创建/var/lib/mysql文件夹。然后运行mysql_install_db -uroot --datadir=/var/lib/mysql,这个目录在移植mysql到arm文中my.conf里面设置的。若还是不行就再后面加--force,跑起来后再启动/etc/init.d/mysql.server start ,启动成功。接下来运行mysql就可以进入数据库了接下来就可以操作数据了。Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.66 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

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

No entry for terminal type "vt102";
using dumb terminal settings.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

(4)另外如果还是启动不了,就先看看是不是开启了相应的mysql服务,使用ps -a | grep mysql,然后杀死相应含有mysql的进程。

(5)如果在交叉编译出现缺少/usr/local/ncurses/lib/libncurses.a,而对应目录下又有这个库文件的时候,就cp /usr/local/ncurses/lib/libncurses.a  /usr/lib/搞定。

以上是我的修改过程。虽然有些许问题,但是至少可以操作数据库了。

0 0
原创粉丝点击