准备安装mysql数据库,发现不能直接安装。
root@EC2022v:/etc# opkg install mysql
Unknown package 'mysql'.
Collected errors:
* opkg_install_cmd: Cannot install package mysql.
于是搜索和mysql有关的包……
root@EC2022v:/etc# opkg list|grep mysql
asterisk11-mysql - 11.12.0-1 - Asterisk is a complete PBX in software. It provides all of the features you would expect from a PBX and more. Asterisk does voice over IP in three protocols, and can interoperate with almost all standards-based telephony equipment using relatively inexpensive hardware. This package provides support MySQL support in Asterisk.
asterisk18-mysql - 1.8.30.0-1 - Asterisk is a complete PBX in software. It provides all of the features you would expect from a PBX and more. Asterisk does voice over IP in three protocols, and can interoperate with almost all standards-based telephony equipment using relatively inexpensive hardware. This package provides support MySQL support in Asterisk.
cbtt-mysql - 20060727-2 - Bittorrent tracker (with mysql support)
kamailio4-mod-db-mysql - 4.1.5-3 - kamailio4 MySQL database-backend module
libdbi-drivers-mysql - 0.9.0-1 - libdbi-drivers-mysql
libmysqlclient - 5.1.73-1 - MySQL client library
libmysqlclient-r - 5.1.73-1 - MySQL client library threadsafe
luasql-mysql - 2.1.1-1 - LuaSQL is a simple interface from Lua to a DBMS. . This package contains the MySQL binding.
mysql-server - 5.1.73-1 - MySQL Server
nfacctd-mysql - 0.14.0-1 - NetFlow accounting daemon with MySQL support
php5-mod-mysql - 5.4.27-1 - MySQL shared module
php5-mod-mysqli - 5.4.27-1 - MySQL Improved Extension shared module
php5-mod-pdo-mysql - 5.4.27-1 - PDO driver for MySQL shared module
pmacctd-mysql - 0.14.0-1 - IP pcap-based accounting daemon with MySQL support
python-mysql - 1.2.2-1 - MySQLdb is an thread-compatible interface to the popular MySQL database server that provides the Python database API.
restund-mod-mysql - 0.4.2-3 - restund MySQL database backend module
sfacctd-mysql - 0.14.0-1 - sFlow accounting daemon with MySQL support
snort-mysql - 2.9.2.2-3 - Snort is an open source network intrusion detection and prevention system. It is capable of performing real-time traffic analysis, alerting, blocking and packet logging on IP networks. It utilizes a combination of protocol analysis and pattern matching in order to detect anomalies, misuse and attacks. This package contains snort with support for logging to a MySQL database.
snort-wireless-mysql - 2.4.3-alpha04-1 - Lightweight Network Intrusion Detection System (MySQL)
strongswan-mod-mysql - 5.3.2-1 - StrongSwan MySQL database interface plugin
uacctd-mysql - 0.14.0-1 - ulog accounting daemon with MySQL support
ulogd-mod-mysql - 1.24-2 - Output plugin for logging to a MySQL database
yate-mod-mysqldb - 5.4.0-1-4 - MySQL Backend DB module for yate
root@EC2022v:/etc#
安装:
root@EC2022v:/etc# opkg install mysql-server
Installing mysql-server (5.1.73-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/oldpackages/mysql-server_5.1.73-1_at91.ipk.
Multiple packages (libpthread and libpthread) providing same name marked HOLD or PREFER. Using latest.
Installing libmysqlclient (5.1.73-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/oldpackages/libmysqlclient_5.1.73-1_at91.ipk.
Installing uclibcxx (0.2.4-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/base/uclibcxx_0.2.4-1_at91.ipk.
Installing libncursesw (5.9-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/base/libncursesw_5.9-1_at91.ipk.
然后就卡在这里了……
重启试一下:
root@EC2022v:~# ping www.baidu.com
PING www.baidu.com (180.97.33.107): 56 data bytes
64 bytes from 180.97.33.107: seq=0 ttl=50 time=53.040 ms
64 bytes from 180.97.33.107: seq=1 ttl=50 time=52.715 ms
^C
--- www.baidu.com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 52.715/52.877/53.040 ms
可以ping通,网络连接正常~
root@EC2022v:~# opkg install mysql-server
Installing mysql-server (5.1.73-1) to root...
Configuring uclibcxx.
Configuring libmysqlclient.
Collected errors:
* opkg_download_pkg: Package mysql-server is not available from any configured src.
* opkg_install_pkg: Failed to download mysql-server. Perhaps you need to run 'opkg update'?
* opkg_install_cmd: Cannot install package mysql-server.
root@EC2022v:~#
安装失败~
尝试opkg update~
root@EC2022v:~# opkg update
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/base/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_base.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/luci/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_luci.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/management/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_management.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/oldpackages/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_oldpackages.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_packages.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/routing/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_routing.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/telephony/Packages.gz.
Updated list of available packages in /var/opkg-lists/barrier_breaker_telephony.
oot@EC2022v:~# opkg install mysql-server
Installing mysql-server (5.1.73-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/oldpackages/mysql-server_5.1.73-1_at91.ipk.
Multiple packages (libpthread and libpthread) providing same name marked HOLD or PREFER. Using latest.
Installing libncursesw (5.9-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/base/libncursesw_5.9-1_at91.ipk.
Configuring libncursesw.
Configuring mysql-server.
Collected errors:
* copy_file_chunk: write: No space left on device.
* file_md5sum_alloc: Failed to open file /etc/my.cnf: No such file or directory.
空间不足?
root@EC2022v:~# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 32.0M 32.0M 36.0K 100% /
ubi0:kernel 19.7M 13.4M 6.3M 68% /rom
tmpfs 59.6M 584.0K 59.1M 1% /tmp
/dev/mtdblock1 32.0M 32.0M 36.0K 100% /overlay
overlayfs:/overlay 32.0M 32.0M 36.0K 100% /
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mtdblock2 188.0M 1.7M 186.3M 1% /mnt/nandflash
root@EC2022v:~# df /etc
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 32768 32728 40 100% /
空间确实不够了……
先卸载,再重装试试,还是不行……
root@EC2022v:/etc# opkg remove mysql-server
Removing package mysql-server from root...
root@EC2022v:/etc# opkg install mysql-server
Installing mysql-server (5.1.73-1) to root...
Collected errors:
* verify_pkg_installable: Only have 48kb available on filesystem /overlay, pkg mysql-server needs 2083
* opkg_install_cmd: Cannot install package mysql-server.
大胆删除root下的各种文件夹~
root@EC2022v:~# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 32.0M 20.1M 11.9M 63% /
ubi0:kernel 19.7M 13.4M 6.3M 68% /rom
tmpfs 59.6M 1.1M 58.6M 2% /tmp
/dev/mtdblock1 32.0M 20.1M 11.9M 63% /overlay
overlayfs:/overlay 32.0M 20.1M 11.9M 63% /
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mtdblock2 188.0M 1.7M 186.3M 1% /mnt/nandflash
然后重装……
root@EC2022v:~# opkg install mysql-server
Installing mysql-server (5.1.73-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/at91/9g20/packages/oldpackages/mysql-server_5.1.73-1_at91.ipk.
Multiple packages (libpthread and libpthread) providing same name marked HOLD or PREFER. Using latest.
Configuring mysql-server.
装完还有空间~
root@EC2022v:~# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 32.0M 23.3M 8.7M 73% /
ubi0:kernel 19.7M 13.4M 6.3M 68% /rom
tmpfs 59.6M 1.1M 58.6M 2% /tmp
/dev/mtdblock1 32.0M 23.3M 8.7M 73% /overlay
overlayfs:/overlay 32.0M 23.3M 8.7M 73% /
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mtdblock2 188.0M 1.7M 186.3M 1% /mnt/nandflash
修改数据存放地址~虽然不要放到Nand里,但是我只能放到Nand里呀。
############ Don't put this on the NAND #############
# Figure out where you are going to put the databases
# And run mysql_install_db --force
datadir = /mnt/nandflash/mysql/
######### This should also not go on the NAND #######
tmpdir = /mnt/nandflash/tmp/
skip-external-locking
bind-address = 0.0.0.0
创建数据文件夹~
root@EC2022v:/etc# cd /mnt/nandflash/
root@EC2022v:/mnt/nandflash# ls
lost+found rsa_test ssltest
root@EC2022v:/mnt/nandflash# mkdir mysql
root@EC2022v:/mnt/nandflash# mkdir tmp
root@EC2022v:/mnt/nandflash#
启动进程,报错需要运行mysql_install_db --force
,但是运行继续报错~
root@EC2022v:/mnt/nandflash# /etc/init.d/mysqld enable
root@EC2022v:/mnt/nandflash# /etc/init.d/mysqld start
/etc/init.d/mysqld: Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables
root@EC2022v:/mnt/nandflash# mysql_install_db --force
/usr/bin/mysql_install_db: line 249: /usr/bin/my_print_defaults: not found
FATAL ERROR: Could not find /usr/lib/mysqld
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
emm……
修改了路径,还是不行……
root@EC2022v:/usr/bin# find / -name mysqld
/etc/init.d/mysqld
/usr/bin/mysqld
/overlay/usr/bin/mysqld
/overlay/etc/init.d/mysqld
root@EC2022v:/usr/bin# cat /etc/my.cnf
[client]
port = 3306
socket = /var/run/mysqld.sock
[mysqld]
user = root
socket = /var/run/mysqld.sock
port = 3306
basedir = /usr/bin
直接复制~
root@EC2022v:/usr/bin# cp /usr/bin/mysqld /usr/lib
root@EC2022v:/usr/bin# mysql_install_db --force
/usr/bin/mysql_install_db: line 249: /usr/bin/my_print_defaults: not found
Installing MySQL system tables...
/usr/bin/mysql_install_db: line 423: /usr/lib/mysqld: not found
Installation of system tables failed! Examine the logs in
/var for more information.
You can try to start the mysqld daemon with:
shell> /usr/lib/mysqld --skip-grant &
and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:
shell> /usr/bin/mysql -u root mysql
mysql> show tables
Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /var that may be helpful.
Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.
Please check all of the above before mailing us! And remember, if
you do mail us, you MUST use the /usr/bin/mysqlbug script!
还是不行……
垃圾板子,毁我青春~!!!!