Openwrt下mysql的使用
来源:互联网 发布:信息检索系统知乎 编辑:程序博客网 时间:2024/06/05 14:16
说明
前段时间由于要求,在openwrt下添加了mysql,刚开始以为会很大,但是在make menuconfig下搜索的时候发现好像只有mysql-server,并没有mysql-client,编译出来的固件也只是比原来的固件大了不到2M(flash是16M的,表示可以接受,如果你的flash是8M的,那么你可以选择安装在U盘或者SD卡上)。
1.安装mysql
make menuconfig
搜索mysql,找到后打上“*”号
mysql-server的附属包有:libmysqlclient,libncursesw,uclibcxx,libreadline。那么我们还要装的最后一个就是libncurses这个包,打上“*”之后开始编译。
编译好之后刷进路由器里。
2.配置mysql
在用ssh进去之后,我们可以看到/usr/bin下有mysqld这个服务,说明我们已经编译进去了,接下来我们开始配置。
1.打开配置文件/etc/my.cnf,这里我们主要修改的是datadir和tmpdir这两个配置项,在这里我把它放在了我挂载的sd卡上,可以根据自己的需求去存放你的mysql表
这里的目录需要手动去创建,不然初始化的时候会出错!!!
3.初始化mysql
mysql_install_db --force
在这里我想说的是,如果你的初始化没问题,那么就可以跳过这一段,如果有如下问题
root@OpenWrt:~# mysql_install_db --forceInstalling MySQL system tables...ERROR: 1049 Unknown database 'mysql'110507 15:01:36 [ERROR] Aborting110507 15:01:36 [Note] /usr/bin/mysqld: Shutdown completeInstallation of system tables failed! Examine the logs in/mnt/data/mysql/ for more information.You can try to start the mysqld daemon with: shell> /usr/bin/mysqld --skip-grant &and use the command line tool /usr/bin/mysqlto connect to the mysql database and look at the grant tables: shell> /usr/bin/mysql -u root mysql mysql> show tablesTry 'mysqld --help' if you have problems with paths. Using --loggives you a log in /mnt/data/mysql/ that may be helpful.Please consult the MySQL manual section'Problems running mysql_install_db', and the manual section thatdescribes problems on your OS. Another information source are theMySQL email archives available at http://lists.mysql.com/.Please check all of the above before mailing us! And remember, ifyou do mail us, you MUST use the /usr/scripts/mysqlbug script!
这里可以用一个成功初始化的mysql去替换掉(当然,这是我的解决方法,你可以自行解决)
4.启动mysql
/etc/init.d/mysqld start
5.更改root密码
mysqladmin -u root password 'newpassword'
6.登陆mysql
mysql -u root -p
这里回车之后会让你输入密码,输入的密码不会显示
OK,现在就可以操作mysql了!!!
0 0
- Openwrt下mysql的使用
- Openwrt上mysql innodb的使用及相关异常情况
- openwrt下mjpg-streamer 使用
- OpenWRT下使用UVC摄像头
- 在openwrt下使用花生壳DDNS的方法
- openwrt的samba使用
- openWrt的使用
- openWrt的使用
- openwrt uci的使用
- openwrt的串口使用
- Openwrt下C调用mysql API
- openwrt下VLAN的配置
- Ubuntu下Openwrt的编译
- openwrt下VLAN的配置
- OpenWrt下的U盘挂载
- openwrt下的samba设置
- OpenWRT下的远程调试
- openwrt下软件包的编译
- Android 上自定义的复式折线图(一)
- 微信公众号发送文本消息时如何在文本消息中包含超链接
- WebService流行框架之Axis和CXF
- Middle-题目60:120. Triangle
- 蓝桥杯 基础练习 十六进制转八进制
- Openwrt下mysql的使用
- Json转换利器Gson之实例一-简单对象转化和带泛型的List转化
- WEBLOGIC启动JVM参数设置经验
- 快速排序算法
- Statement和PreparedStatement批量更新
- Middle-题目61:63. Unique Paths II
- 02-线性结构3 Pop Sequence
- 正则验收:对邮箱、手机号码、身份证、电话、整数、正数、字符串是否为空等一些验证
- MySQL 5.7 主从数据库搭建