Use of mysql innodb on Openwrt and related exceptions, openwrtinnodb

Source: Internet
Author: User

Use of mysql innodb on Openwrt and related exceptions, openwrtinnodb

First, configure mysql in menuconfig, specifically in Utilities-> database-> mysql-server. In this way, you can compile it directly. However, innodb Storage engine is not supported by default. It is estimated that openwrt is generally related to running hardware, there is no need for such a complex storage engine (which consumes more space than the MyISAM storage engine ). However, what should I do if I need to support the innodb Storage engine? There are not many posts of this type on the Internet. I have tested them by referring to the foreign forums.

Openwrt supports the innodb Storage Engine
Modify feeds/oldpackages/libs/mysql/Makefile
Add -- with-innodb before -- with-server

Modify feeds/oldpackages/libs/mysql/conf/my. cnf
Add default-storage-engine = INNODB in [mysqld]
Download bind-address = 127.0.0.1 and add
Innodb
Innodb_file_per_table = 1
Innodb_flush_log_at_trx_commit = 2

Add/etc/init. d/mysqld script start Function

start() {local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" /etc/my.cnf)local mysqldatadir="/mnt/data/mysql/"        local mysqltmpdir="/mnt/data/tmp/"local mysqlsrvdir="/srv/mysql/"        if [ ! -d "$mysqldatadir" ]; then                echo "create dir /mnt/data/mysql/..."                mkdir -p "$mysqldatadir"        fi        if [ ! -d "$mysqltmpdir" ]; then            echo "create dir /mnt/data/tmp/..."mkdir -p "$mysqltmpdir"fiif [ ! -d "$mysqlsrvdir" ]; then            echo "create dir /srv/mysql/..."mkdir -p "$mysqlsrvdir"fiif [ ! -d "$datadir" ]; thenerror "Error: datadir '$datadir' in /etc/my.cnf doesn't exist"return 1fiif [ ! -f "$datadir/mysql/tables_priv.MYD" ]; thenmysql_install_db --forceservice_stop /usr/bin/mysqld#error "Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables"#return 1fiservice_start /usr/bin/mysqld}
Now, MySQL based on innodb can run normally.
On openwrt Based on netgear3700v2 hardware, innodb initialization may occur. The exception is that socket creation fails, the prompt is as follows: Can't connect to local MySQL server through socket '/var/run/mysqld. sock '. In fact, this is because the innodb initialization fails, because the netgear3700v2 flash is only 16 MB, which cannot meet the innodb operation requirements. The total data file size must be at least 10 MB. By typing the mysqld -- skip-grant & command, the following information may be printed:
Root @ BDCOM_AP:/# mysqld -- skip-grant &
Root @ BDCOM_AP:/#150203 1:32:31 InnoDB: Initializing buffer pool, size = 8.0 M
150203 1:32:31 InnoDB: Completed initialization of buffer pool
InnoDB: Error: auto-extending data file./ibdata1 is of a different size
InnoDB: 64 pages (rounded down to MB) than specified in the. cnf file:
InnoDB: initial 640 pages, max 0 (relevant if non-zero) pages!
InnoDB: cocould not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you shocould now edit innodb_data_file_path in my. cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
150203 1:32:31 [ERROR] Plugin 'innodb' init function returned error.
150203 1:32:31 [ERROR] Plugin 'innodb' registry as a storage engine failed.
150203 1:32:31 [ERROR] Unknown/unsupported table type: INNODB
150203 1:32:31 [ERROR] Aborting

150203 1:32:31 [Note] mysqld: Shutdown complete

The above inexplicable problem is indeed caused by insufficient flash space. The solution is to mount a USB flash disk on the vro. The configuration items for attaching a USB flash drive are:
Kernel modules-> filesystems-> kmod-fs-vfat
Kernel modules-> native language support-> kmod-nls-cp437/kmod-nls-iso8859-1/kmod-nls-utf-8
Kernel modules-> usb support-> kmod-usb-core/kmod-usb-ohci/kmod-usb-storage/kmod-usb-usb2
.
In addition, in the init initialization script, if multiple mysql operations are executed sequentially, for example, after mysql_install_db -- force command and mysqladmin-u root password '123, before mysql_install_db is executed, the mysqladmin command is executed. The solution to this problem is to add sleep time. The specific time can be determined based on the situation.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.