[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MySQL on DD-WRT with optware atheros

Posted on 2011-04-24
9
Medium Priority
?
5,329 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





0
Comment
Question by:livegirllove
  • 5
  • 4
9 Comments
 
LVL 24

Expert Comment

by:johanntagle
ID: 35456027
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
0
 
LVL 1

Author Comment

by:livegirllove
ID: 35457040
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)
0
 
LVL 24

Accepted Solution

by:
johanntagle earned 2000 total points
ID: 35457251
Looks like your mysql installation is quite shot, it's not even referring to the full path for the socket file - it should be /path/to/mysql.sock (usually /tmp/mysql.sock), not just /tmp.

You can try looking for this file (it might also be named mysqld.sock, not mysql.sock), then call mysql via with this additional param i.e.

mysql -u root mysql --socket=/path/to/mysql.sock < fill_help_tables.sql

But if you encounter more problems I would suggest reinstalling mysql (maybe from binaries if it is really the package installed via opkg that is the problem)
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 1

Author Comment

by:livegirllove
ID: 35462795
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?
0
 
LVL 24

Expert Comment

by:johanntagle
ID: 35463287
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.
0
 
LVL 1

Author Comment

by:livegirllove
ID: 35480199
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?  
0
 
LVL 24

Expert Comment

by:johanntagle
ID: 35487248
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.
0
 
LVL 1

Author Comment

by:livegirllove
ID: 35496607
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
0
 
LVL 1

Author Comment

by:livegirllove
ID: 35860238
started over and finally got it installed.  
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question