Bug #47640 Can't access Rails app,MySQL error!
Submitted: 25 Sep 2009 4:09 Modified: 25 Oct 2009 9:18
Reporter: Yuping Zhong Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version: OS:MacOS (10.6 Snow Leopard)
Assigned to: CPU Architecture:Any

[25 Sep 2009 4:09] Yuping Zhong
Description:
dyld: NSLinkModule() error
dyld: Symbol not found: _mysql_affected_rows
  Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
  Expected in: flat namespace
in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Trace/BPT trap

How to repeat:
I just install the Snow Leopard,and the mysql is installed successfully.
When I run the Rails app in the Terminal:ruby script/server.
I get the above error:

Any help will be very appreciated!
Many thanks!
[25 Sep 2009 4:15] Valeriy Kravchuk
What exact version of MySQL server and from what source you had installed?
[25 Sep 2009 4:34] Yuping Zhong
mysql-5.1.37

from this link: 
http://opensource.become.com/mysql/Downloads/MySQL-5.1/mysql-5.1.37.tar.gz

and install the Mysql according to this article:
http://hivelogic.com/articles/compiling-mysql-on-snow-leopard/
[25 Sep 2009 4:52] Yuping Zhong
Right now,I am not sure whether the mysql is installed successfully.

When I type:
mysql -uroot
>>Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.37 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

But anthoer way to test the installation will get the same error:
$irb
irb(main):001:0> require "rubygems"
=> true
irb(main):002:0> require "mysql"
dyld: NSLinkModule() error
dyld: Symbol not found: _mysql_affected_rows
  Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
  Expected in: flat namespace
 in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Trace/BPT trap
[25 Sep 2009 7:40] Valeriy Kravchuk
Please, send the results of:

echo $PATH
ls -l /usr/local/mysql

Had you perfromed the last step as desribed in that article:

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
[25 Sep 2009 8:26] Yuping Zhong
echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

ls -l/usr/local/mysql
ls: illegal option -- /
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]
[25 Sep 2009 8:30] Yuping Zhong
yes,I already do the "sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql"
and get the following,any problem of this process?

$ sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
Password:
Building native extensions.  This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...

No definition for next_result

No definition for field_name

No definition for field_table

No definition for field_def

No definition for field_type

No definition for field_length

No definition for field_max_length

No definition for field_flags

No definition for field_decimals

No definition for time_inspect

No definition for time_to_s

No definition for time_get_year

No definition for time_get_month

No definition for time_get_day

No definition for time_get_hour

No definition for time_get_minute

No definition for time_get_second

No definition for time_get_neg

No definition for time_get_second_part

No definition for time_set_year

No definition for time_set_month

No definition for time_set_day

No definition for time_set_hour

No definition for time_set_minute

No definition for time_set_second

No definition for time_set_neg

No definition for time_set_second_part

No definition for time_equal

No definition for error_errno

No definition for error_sqlstate
Installing RDoc documentation for mysql-2.8.1...

No definition for next_result

No definition for field_name

No definition for field_table

No definition for field_def

No definition for field_type

No definition for field_length

No definition for field_max_length

No definition for field_flags

No definition for field_decimals

No definition for time_inspect

No definition for time_to_s

No definition for time_get_year

No definition for time_get_month

No definition for time_get_day

No definition for time_get_hour

No definition for time_get_minute

No definition for time_get_second

No definition for time_get_neg

No definition for time_get_second_part

No definition for time_set_year

No definition for time_set_month

No definition for time_set_day

No definition for time_set_hour

No definition for time_set_minute

No definition for time_set_second

No definition for time_set_neg

No definition for time_set_second_part

No definition for time_equal

No definition for error_errno

No definition for error_sqlstate
[25 Sep 2009 8:36] Valeriy Kravchuk
Please, just copy and paste this command to the terminal window:

ls -l /usr/local/mysql

Note space between -l and /usr... It is important. I need to know if you really have MySQL files installed in this directory.
[25 Sep 2009 8:47] Yuping Zhong
OK,sorry for that.

$ ls -l /usr/local/mysql
lrwxr-xr-x  1 root  wheel  27 Sep 25 14:58 /usr/local/mysql -> mysql-5.1.39-osx10.5-x86_64
[25 Sep 2009 9:02] Valeriy Kravchuk
OK, what about the results of:

ls -l /usr/local/mysql/*

then?
[25 Sep 2009 9:13] Yuping Zhong
ls -l /usr/local/mysql/*
-rw-r--r--  1 root  wheel  19071 Sep  5 03:18 /usr/local/mysql/COPYING
-rw-r--r--  1 root  wheel   5139 Sep  5 03:18 /usr/local/mysql/EXCEPTIONS-CLIENT
-rw-r--r--  1 root  wheel   8882 Sep  5 03:18 /usr/local/mysql/INSTALL-BINARY
-rw-r--r--  1 root  wheel  62989 Sep  5 03:18 /usr/local/mysql/README

/usr/local/mysql/bin:
total 166840
-rwxr-xr-x  1 root  wheel     14080 Sep  5 03:18 innochecksum
-rwxr-xr-x  1 root  wheel      1424 Sep  5 03:18 msql2mysql
-rwxr-xr-x  1 root  wheel   1379152 Sep  5 03:18 my_print_defaults
-rwxr-xr-x  1 root  wheel   1673776 Sep  5 03:18 myisam_ftdump
-rwxr-xr-x  1 root  wheel   1793496 Sep  5 03:18 myisamchk
-rwxr-xr-x  1 root  wheel   1674144 Sep  5 03:18 myisamlog
-rwxr-xr-x  1 root  wheel   1710704 Sep  5 03:18 myisampack
-rwxr-xr-x  1 root  wheel   2752240 Sep  5 03:18 mysql
-rwxr-xr-x  1 root  wheel   2745672 Sep  5 03:18 mysql_client_test
-rwxr-xr-x  1 root  wheel  10005328 Sep  5 03:18 mysql_client_test_embedded
-rwxr-xr-x  1 root  wheel      6149 Sep  5 03:18 mysql_config
-rwxr-xr-x  1 root  wheel      4169 Sep  5 03:18 mysql_convert_table_format
-rwxr-xr-x  1 root  wheel      3245 Sep  5 03:18 mysql_find_rows
-rwxr-xr-x  1 root  wheel       483 Sep  5 03:18 mysql_fix_extensions
-rwxr-xr-x  1 root  wheel      5888 Sep  5 03:18 mysql_fix_privilege_tables
-rwxr-xr-x  1 root  wheel      6586 Sep  5 03:18 mysql_secure_installation
-rwxr-xr-x  1 root  wheel     16689 Sep  5 03:18 mysql_setpermission
-rwxr-xr-x  1 root  wheel   1354408 Sep  5 03:18 mysql_tzinfo_to_sql
-rwxr-xr-x  1 root  wheel   1434248 Sep  5 03:18 mysql_upgrade
-rwxr-xr-x  1 root  wheel    175888 Sep  5 03:18 mysql_waitpid
-rwxr-xr-x  1 root  wheel      3818 Sep  5 03:18 mysql_zap
-rwxr-xr-x  1 root  wheel    110848 Sep  5 03:18 mysqlaccess
-rw-r--r--  1 root  wheel      1702 Sep  5 03:18 mysqlaccess.conf
-rwxr-xr-x  1 root  wheel   2397488 Sep  5 03:18 mysqladmin
-rwxr-xr-x  1 root  wheel   2561616 Sep  5 03:18 mysqlbinlog
-rwxr-xr-x  1 root  wheel     11851 Sep  5 03:18 mysqlbug
-rwxr-xr-x  1 root  wheel   2392152 Sep  5 03:18 mysqlcheck
-rwxr-xr-x  1 root  wheel  10030384 Sep  5 03:18 mysqld
-rwxr-xr-x  1 root  wheel  10981952 Sep  5 03:18 mysqld-debug
-rwxr-xr-x  1 root  wheel     23257 Sep  5 03:18 mysqld_multi
-rwxr-xr-x  1 root  wheel     16670 Sep  5 03:18 mysqld_safe
-rwxr-xr-x  1 root  wheel   2458680 Sep  5 03:18 mysqldump
-rwxr-xr-x  1 root  wheel      6602 Sep  5 03:18 mysqldumpslow
-rwxr-xr-x  1 root  wheel     31485 Sep  5 03:18 mysqlhotcopy
-rwxr-xr-x  1 root  wheel   2398568 Sep  5 03:18 mysqlimport
-rwxr-xr-x  1 root  wheel   2510488 Sep  5 03:18 mysqlmanager
-rwxr-xr-x  1 root  wheel   2391424 Sep  5 03:18 mysqlshow
-rwxr-xr-x  1 root  wheel   2415152 Sep  5 03:18 mysqlslap
-rwxr-xr-x  1 root  wheel   2576096 Sep  5 03:18 mysqltest
-rwxr-xr-x  1 root  wheel   9791464 Sep  5 03:18 mysqltest_embedded
-rwxr-xr-x  1 root  wheel   1374496 Sep  5 03:18 perror
-rwxr-xr-x  1 root  wheel   1367912 Sep  5 03:18 replace
-rwxr-xr-x  1 root  wheel   1366144 Sep  5 03:18 resolve_stack_dump
-rwxr-xr-x  1 root  wheel   1361176 Sep  5 03:18 resolveip

/usr/local/mysql/data:
ls: data: Permission denied

/usr/local/mysql/docs:
total 23584
-rw-r--r--  1 root  wheel       795 Sep  5 03:18 ChangeLog
-rw-r--r--  1 root  wheel  12068543 Sep  5 03:18 mysql.info

/usr/local/mysql/include:
total 864
-rw-r--r--  1 root  wheel   4058 Sep  5 03:18 decimal.h
-rw-r--r--  1 root  wheel   3854 Sep  5 03:18 errmsg.h
-rw-r--r--  1 root  wheel   6954 Sep  5 03:18 keycache.h
-rw-r--r--  1 root  wheel  22690 Sep  5 03:18 m_ctype.h
-rw-r--r--  1 root  wheel   8256 Sep  5 03:18 m_string.h
-rw-r--r--  1 root  wheel   1804 Sep  5 03:18 my_alloc.h
-rw-r--r--  1 root  wheel   1941 Sep  5 03:18 my_attribute.h
-rw-r--r--  1 root  wheel  36576 Sep  5 03:18 my_config.h
-rw-r--r--  1 root  wheel   4576 Sep  5 03:18 my_dbug.h
-rw-r--r--  1 root  wheel   3460 Sep  5 03:18 my_dir.h
-rw-r--r--  1 root  wheel   3315 Sep  5 03:18 my_getopt.h
-rw-r--r--  1 root  wheel  52943 Sep  5 03:18 my_global.h
-rw-r--r--  1 root  wheel   1488 Sep  5 03:18 my_list.h
-rw-r--r--  1 root  wheel   3656 Sep  5 03:18 my_net.h
-rw-r--r--  1 root  wheel   1542 Sep  5 03:18 my_no_pthread.h
-rw-r--r--  1 root  wheel  26589 Sep  5 03:18 my_pthread.h
-rw-r--r--  1 root  wheel  40300 Sep  5 03:18 my_sys.h
-rw-r--r--  1 root  wheel   2677 Sep  5 03:18 my_xml.h
-rw-r--r--  1 root  wheel  33654 Sep  5 03:18 mysql.h
-rw-r--r--  1 root  wheel  20174 Sep  5 03:18 mysql_com.h
-rw-r--r--  1 root  wheel   1130 Sep  5 03:18 mysql_embed.h
-rw-r--r--  1 root  wheel   2097 Sep  5 03:18 mysql_time.h
-rw-r--r--  1 root  wheel    820 Sep  5 03:18 mysql_version.h
-rw-r--r--  1 root  wheel  23375 Sep  5 03:18 mysqld_ername.h
-rw-r--r--  1 root  wheel  23430 Sep  5 03:18 mysqld_error.h
-rw-r--r--  1 root  wheel  29104 Sep  5 03:18 plugin.h
-rw-r--r--  1 root  wheel   1957 Sep  5 03:18 sql_common.h
-rw-r--r--  1 root  wheel  12332 Sep  5 03:18 sql_state.h
-rw-r--r--  1 root  wheel   1006 Sep  5 03:18 sslopt-case.h
-rw-r--r--  1 root  wheel   2205 Sep  5 03:18 sslopt-longopts.h
-rw-r--r--  1 root  wheel   1107 Sep  5 03:18 sslopt-vars.h
-rw-r--r--  1 root  wheel   1501 Sep  5 03:18 typelib.h

/usr/local/mysql/lib:
total 147928
-rw-r--r--   1 root  wheel      4280 Sep  5 03:18 libdbug.a
-rw-r--r--   1 root  wheel    614104 Sep  5 03:18 libheap.a
-rw-r--r--   1 root  wheel    280352 Sep 24  2007 libmygcc.a
-rw-r--r--   1 root  wheel   2406240 Sep  5 03:18 libmyisam.a
-rw-r--r--   1 root  wheel    782504 Sep  5 03:18 libmyisammrg.a
-rwxr-xr-x   1 root  wheel   2488664 Sep  5 03:18 libmysqlclient.16.dylib
-rw-r--r--   1 root  wheel   6943444 Sep  5 03:18 libmysqlclient.a
lrwxr-xr-x   1 root  wheel        23 Sep 25 14:58 libmysqlclient.dylib -> libmysqlclient.16.dylib
-rwxr-xr-x   1 root  wheel       967 Sep  5 03:18 libmysqlclient.la
-rwxr-xr-x   1 root  wheel   2502032 Sep  5 03:18 libmysqlclient_r.16.dylib
-rw-r--r--   1 root  wheel   6978564 Sep  5 03:18 libmysqlclient_r.a
lrwxr-xr-x   1 root  wheel        25 Sep 25 14:58 libmysqlclient_r.dylib -> libmysqlclient_r.16.dylib
-rwxr-xr-x   1 root  wheel       979 Sep  5 03:18 libmysqlclient_r.la
-rw-r--r--   1 root  wheel  49122884 Sep  5 03:18 libmysqld.a
-rw-r--r--   1 root  wheel   1995376 Sep  5 03:18 libmystrings.a
-rw-r--r--   1 root  wheel   1237772 Sep  5 03:18 libmysys.a
-rw-r--r--   1 root  wheel     56016 Sep  5 03:18 libvio.a
-rw-r--r--   1 root  wheel    276720 Sep  5 03:18 libz.a
-rwxr-xr-x   1 root  wheel       869 Sep  5 03:18 libz.la
drwxr-xr-x  14 root  wheel       476 Sep 25 14:59 plugin
[25 Sep 2009 9:13] Yuping Zhong
/usr/local/mysql/man:
total 0
drwxr-xr-x  48 root  wheel  1632 Sep  5 03:18 man1
drwxr-xr-x   4 root  wheel   136 Sep  5 03:18 man8

/usr/local/mysql/mysql-test:
total 952
drwxr-xr-x    8 root  wheel     272 Sep  5 03:18 collections
drwxr-xr-x    4 root  wheel     136 Sep  5 03:18 extra
drwxr-xr-x  217 root  wheel    7378 Sep  5 03:18 include
drwxr-xr-x   14 root  wheel     476 Sep  5 03:18 lib
-rwxr-xr-x    1 root  wheel  144556 Sep  5 03:18 mtr
-rwxr-xr-x    1 root  wheel   32425 Sep  5 03:18 mysql-stress-test.pl
-rwxr-xr-x    1 root  wheel  144556 Sep  5 03:18 mysql-test-run
-rwxr-xr-x    1 root  wheel  144556 Sep  5 03:18 mysql-test-run.pl
drwxr-xr-x  562 root  wheel   19108 Sep  5 03:18 r
drwxr-xr-x   68 root  wheel    2312 Sep  5 03:18 std_data
drwxr-xr-x   16 root  wheel     544 Sep  5 03:18 suite
drwxr-xr-x  590 root  wheel   20060 Sep  5 03:18 t
-rw-r--r--    1 root  wheel   10028 Sep  5 03:18 valgrind.supp

/usr/local/mysql/scripts:
total 32
-rwxr-xr-x  1 root  wheel  14509 Sep  5 03:18 mysql_install_db

/usr/local/mysql/share:
total 2160
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 aclocal
drwxr-xr-x  28 root  wheel     952 Sep  5 03:18 charsets
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 czech
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 danish
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 dutch
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 english
-rw-r--r--   1 root  wheel  415783 Sep  5 03:18 errmsg.txt
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 estonian
-rw-r--r--   1 root  wheel  591286 Sep  5 03:18 fill_help_tables.sql
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 french
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 german
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 greek
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 hungarian
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 italian
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 japanese
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 korean
-rw-r--r--   1 root  wheel    5006 Sep  5 03:18 mi_test_all
-rw-r--r--   1 root  wheel    1517 Sep  5 03:18 mi_test_all.res
-rw-r--r--   1 root  wheel   42121 Sep  5 03:18 mysql_fix_privilege_tables.sql
-rw-r--r--   1 root  wheel   16510 Sep  5 03:18 mysql_system_tables.sql
-rw-r--r--   1 root  wheel    1878 Sep  5 03:18 mysql_system_tables_data.sql
-rw-r--r--   1 root  wheel    9669 Sep  5 03:18 mysql_test_data_timezone.sql
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 norwegian
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 norwegian-ny
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 polish
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 portuguese
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 romanian
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 russian
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 serbian
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 slovak
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 spanish
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 swedish
drwxr-xr-x   3 root  wheel     102 Sep  5 03:18 ukrainian

/usr/local/mysql/sql-bench:
total 1072
drwxr-xr-x  10 root  wheel     340 Sep  5 03:18 Comments
drwxr-xr-x   4 root  wheel     136 Sep  5 03:18 Data
-rw-r--r--   1 root  wheel    4163 Sep  5 03:18 README
-rwxr-xr-x   1 root  wheel    7296 Sep  5 03:18 bench-count-distinct
-rwxr-xr-x   1 root  wheel   15760 Sep  5 03:18 bench-init.pl
-rwxr-xr-x   1 root  wheel   16147 Sep  5 03:18 compare-results
-rwxr-xr-x   1 root  wheel    9751 Sep  5 03:18 copy-db
-rwxr-xr-x   1 root  wheel  158958 Sep  5 03:18 crash-me
-rwxr-xr-x   1 root  wheel   22113 Sep  5 03:18 graph-compare-results
-rwxr-xr-x   1 root  wheel    4965 Sep  5 03:18 innotest1
-rwxr-xr-x   1 root  wheel    3999 Sep  5 03:18 innotest1a
-rwxr-xr-x   1 root  wheel    3560 Sep  5 03:18 innotest1b
-rwxr-xr-x   1 root  wheel    5212 Sep  5 03:18 innotest2
-rwxr-xr-x   1 root  wheel    2885 Sep  5 03:18 innotest2a
-rwxr-xr-x   1 root  wheel    3232 Sep  5 03:18 innotest2b
drwxr-xr-x  27 root  wheel     918 Sep  5 03:18 limits
-rwxr-xr-x   1 root  wheel    7181 Sep  5 03:18 run-all-tests
-rwxr-xr-x   1 root  wheel  105243 Sep  5 03:18 server-cfg
-rwxr-xr-x   1 root  wheel   24963 Sep  5 03:18 test-ATIS
-rwxr-xr-x   1 root  wheel    5978 Sep  5 03:18 test-alter-table
-rwxr-xr-x   1 root  wheel    4376 Sep  5 03:18 test-big-tables
-rwxr-xr-x   1 root  wheel    9733 Sep  5 03:18 test-connect
-rwxr-xr-x   1 root  wheel    6968 Sep  5 03:18 test-create
-rwxr-xr-x   1 root  wheel   50601 Sep  5 03:18 test-insert
-rwxr-xr-x   1 root  wheel   13759 Sep  5 03:18 test-select
-rwxr-xr-x   1 root  wheel    7083 Sep  5 03:18 test-transactions
-rwxr-xr-x   1 root  wheel   11957 Sep  5 03:18 test-wisconsin

/usr/local/mysql/support-files:
total 184
-rw-r--r--  1 root  wheel    801 Sep  5 03:18 binary-configure
-rw-r--r--  1 root  wheel   3805 Sep  5 03:18 config.huge.ini
-rw-r--r--  1 root  wheel   1661 Sep  5 03:18 config.medium.ini
-rw-r--r--  1 root  wheel    905 Sep  5 03:18 config.small.ini
-rw-r--r--  1 root  wheel    773 Sep  5 03:18 magic
-rw-r--r--  1 root  wheel   4781 Sep  5 03:18 my-huge.cnf
-rw-r--r--  1 root  wheel  20168 Sep  5 03:18 my-innodb-heavy-4G.cnf
-rw-r--r--  1 root  wheel   4755 Sep  5 03:18 my-large.cnf
-rw-r--r--  1 root  wheel   4766 Sep  5 03:18 my-medium.cnf
-rw-r--r--  1 root  wheel   2404 Sep  5 03:18 my-small.cnf
-rw-r--r--  1 root  wheel    839 Sep  5 03:18 mysql-log-rotate
-rwxr-xr-x  1 root  wheel  12253 Sep  5 03:18 mysql.server
-rwxr-xr-x  1 root  wheel   1061 Sep  5 03:18 mysqld_multi.server
-rw-r--r--  1 root  wheel    589 Sep  5 03:18 ndb-config-2-node.ini
[25 Sep 2009 9:14] Yuping Zhong
The content is too large,so I submit in two parts.
[25 Sep 2009 9:18] Valeriy Kravchuk
If you built it from sources recently, as described in that article, why only symlinks in /usr/local/mysql/lib are dated Sep 25, while the libraries themselves are dated Sep 5? This is strange.
[26 Oct 2009 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".