We help IT Professionals succeed at work.

MySQL on DD-WRT with optware atheros

livegirllove
livegirllove asked
on
Medium Priority
5,864 Views
Last Modified: 2012-05-11
opkg install mysql-server
mysql_install_db --defaults-file=/opt/etc/my.cnf --force
 returns :
Could not find help file 'fill_help_tables.sql' in /usr/share/mysql or inside /usr.

Open in new window


fill_help_tables.sql is located at /mnt/opt/usr/share/mysql

my.conf is a direct copy of my-small.conf example from mysql.

Any ideas?
I do have PHP and lighthttpd running well on this Buffalo WZR-HP-G300NH router using the guide here: http://g300nh.blogspot.com/2010/06/lighttpd-and-php-on-dd-wrt.html?showComment=1303637577840#c4662496243907898307

supposedly these instructions have worked for somebody but not me:
to install mysql server... 
Openwrt contains mysql server in 10.03.1-rc4
1. update /etc/opkg.conf to

src/gz snapshots http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/package
dest root /opt
dest ram /tmp
lists_dir ext /tmp/var/opkg-lists

2. Run opkg update
3. Run opkg install mysql-server
4. modify /opt/etc/my.cnf to set the database variables, recommend to use my-small.cnf example from mysql
5. Run mkdir 
6. Run mysql_install_db --defaults-file=/opt/etc/my.cnf --force
7. Replace /opt/etc/init.d/mysqld with...
#!/bin/sh

source /mnt/root/.profile


BIN=mysqld
RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
COND=$1
[ $# -eq 0 ] && COND="start"

case $COND in
stop)
start-stop-daemon -K -n $BIN
;;
start)
start-stop-daemon -p $PID_F -b -m -S -x $BIN -- --defaults-file=/opt/etc/my.cnf
;;
*)
exit 1
esac
8. set mysqld as service
chmod a+x /opt/etc/init.d/mysqld
ln -s /opt/etc/init.d/mysqld /opt/etc/init.d/S70mysqld
9. start mysqld by /opt/etc/init.d/mysqld start
10. remember to change root password by 
mysqladmin --defaults-file=/opt/etc/my.cnf -u root password 'new-password'
11. after this, mysqld should be found in ps command. to enter mysql in console, run mysql --defaults-file=/opt/etc/my.cnf 

Open in new window


I suspect my my.conf is incorrect but not sure what to change.
# Example MySQL config file for small systems.
#
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password       = dudevin
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (using the "enable-named-pipe" option) will render mysqld useless!
# 
#skip-networking
server-id       = 1

# Uncomment the following if you want to log updates
#log-bin=mysql-bin

# Uncomment the following if you are NOT using BDB tables
#skip-bdb

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql/
#innodb_log_arch_dir = /var/lib/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout

Open in new window





Comment
Watch Question

Top Expert 2012

Commented:
Try:

cd /mnt/opt/usr/share/mysql
mysql -u root mysql < fill_help_tables.sql

Got that from http://dev.mysql.com/doc/refman/5.0/en/server-side-help-support.html

Author

Commented:
root@DD-WRT root # cd /mnt/opt/usr/share/mysql
root@DD-WRT mysql # mysql -u root mysql < fill_help_tables.sql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp' (146)
Top Expert 2012
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
must be pretty messed up.  find / -name 'mysql*.sock"
finds nothing.

Is installing from binarys something you can assist with or is that a new question thing?
Top Expert 2012

Commented:
Installing from binaries is pretty straightforward.  See http://dev.mysql.com/doc/refman/5.0/en/binary-installation.html

But if you encounter problems, feel free to ask.  I think it's okay to post it in this thread.

Author

Commented:
ok i failed miserably on that.  
First it says its a tar.gz in the instruction..  I downloaded a tar.tar?  which ive never seen before.

The instructions reference mysql_install_db  but all i see is mysql_install_db.sh and the script fails.  

There were a few other things that didnt match the instructions either.
So can you link the proper "binary" i need?  Maybe a link to a more idiots guide?  
Top Expert 2012

Commented:
It looks like you downloaded an old version of mysql, if you see mysql_install_db.sh.  Actually, I'm not sure if there is a special mysql package for dd-wrt.  I really haven't used that environment so I wouldn't know.  But going back to your previous post:

root@DD-WRT root # cd /mnt/opt/usr/share/mysql
root@DD-WRT mysql # mysql -u root mysql < fill_help_tables.sql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp' (146)

I missed asking, did you check if mysql was even running via "ps -ef | grep mysql" ?  Not finding a socket file anywhere tells me mysql isn't even running. Where it was looking for the socket file is also inconsistent vs the following line in your my.cnf

socket          = /var/run/mysqld/mysqld.sock

Open in new window


I'm not sure if I can help any further, sorry.  Installing mysql has always been straightforward for me.  But then again, I've always only used it on "standard" servers, not something like dd-wrt.  But maybe if you post the details of the error of mysql_install_db.sh, somebody else can take over helping you.

Author

Commented:
Well i tried again with the command from the post after changing my my.conf to have basedir = /mnt/opt/etc/usr and got something new.
Code:

root@DD-WRT / # mysql_install_db --defaults-file=/opt/etc/my.cnf --force
/opt/usr/bin/mysql_install_db: line 191: chown: not found
Installing all prepared tables
Fill help tables

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:
/mnt/opt/usr//bin/mysqladmin -u root password 'new-password'
/mnt/opt/usr//bin/mysqladmin -u root -h DD-WRT password 'new-password'
See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /mnt/opt/usr//bin/mysqld_safe & 

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com 
Support MySQL by buying support/licenses at https://order.mysql.com 
 


woohoo.. So I completed the next steps:
Code:
root@DD-WRT /usr # chmod a+x /mnt/opt/etc/init.d/mysqld
root@DD-WRT /usr # ln -s /mnt/opt/etc/init.d/mysqld /mnt/opt/etc/init.d/S70mysql
d
root@DD-WRT /usr # /mnt/opt/init.d/mysqld start
-sh: /mnt/opt/init.d/mysqld: not found
root@DD-WRT /usr # /mnt/opt/etc/init.d/mysqld start
/mnt/opt/etc/init.d/mysqld: line 21: start-stop-daemon: not found
 


/mnt/opt/etc/init.d/mysqld
looks like this:
Code:

#!/bin/sh

source /mnt/root/.profile


BIN=mysqld
RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
COND=$1
[ $# -eq 0 ] && COND="start"

case $COND in
stop)
start-stop-daemon -K -n $BIN
;;
start)
start-stop-daemon -p $PID_F -b -m -S -x $BIN -- --defaults-file=/mnt/opt/etc/my.cnf
;;
*)
exit 1
esac

Author

Commented:
started over and finally got it installed.  
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.