MySQL 5.5 on Lion not working

I installed MySQL 5.5 through a disk image on Mac OS X 10.7. I also added /usr/local/mysql/bin to my path in .bash_profile .

which mysql returns /usr/local/mysql/bin/mysql

However, I cannot get the server to work, no matter what I try to do.

mysql -u root returns:

 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 

sudo /usr/local/mysql/bin/mysqld_safe starts and then stops the daemon immediately:

 120130 23:18:57 mysqld_safe Logging to '/usr/local/mysql/data/Bryans-Macbook-Pro.local.err'. 120130 23:18:57 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data 120130 23:18:59 mysqld_safe mysqld from pid file /usr/local/mysql/data/Bryans-Macbook-Pro.local.pid ended 

I feel like I have tried all the possible solutions that can be found, and now I am not in the know. I even tried installing an older version of MySQL (5.1) and got the same results and efforts.

ADDITIONAL INFORMATION

Running mysqld results in:

 $ mysqld 120209 0:02:23 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.5.20-osx10.6-x86_64/data/ is case insensitive 120209 0:02:23 [Note] Plugin 'FEDERATED' is disabled. mysqld: Table 'mysql.plugin' doesn't exist 120209 0:02:23 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 120209 0:02:23 InnoDB: The InnoDB memory heap is disabled 120209 0:02:23 InnoDB: Mutexes and rw_locks use GCC atomic builtins 120209 0:02:23 InnoDB: Compressed tables use zlib 1.2.3 120209 0:02:23 InnoDB: Initializing buffer pool, size = 128.0M 120209 0:02:23 InnoDB: Completed initialization of buffer pool 120209 0:02:23 InnoDB: highest supported file format is Barracuda. 120209 0:02:23 InnoDB: 1.1.8 started; log sequence number 1595675 120209 0:02:23 [ERROR] mysqld: unknown option '--skip-locking' 120209 0:02:23 [ERROR] Aborting 120209 0:02:23 InnoDB: Starting shutdown... 120209 0:02:24 InnoDB: Shutdown completed; log sequence number 1595675 120209 0:02:24 [Note] mysqld: Shutdown complete 

UPDATE

Well, I completely uninstalled mysql from my system, reinstalled the older version (5.1), and it actually starts now. However, I still cannot start the rails server . I get the following error:

 /Users/bricker/.rvm/gems/ruby-1.8.7-p352/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle: dlopen(/Users/bricker/.rvm/gems/ruby-1.8.7-p352/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle, 9): Library not loaded: /opt/local/lib/mysql5/mysql/libmysqlclient_r.16.dylib (LoadError) 

So, I ran this command:

 sudo install_name_tool -change libmysqlclient_r.16.dylib /opt/local/lib/mysql5/mysql/libmysqlclient_r.16.dylib ~/.rvm/gems/ruby-1.8.7-p352/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle 

But still get an error when you try to start the "rail server".

UPDATE 2

Well, the final update: after all, reinstalling mysql many times, seeing all these errors - it turns out that the original problem was the conflict between the mysql2-0.2.7 and mysql2-0.3.11 . Ultimately fix the problem:

  • Removed all mysql related files from my system (see below bash script)

  • Installed MySQL 5.1.61 (64-bit) from the disk image provided on the MySQL website

  • Run the following lines:

sudo install_name_tool -change libmysqlclient_r.16.dylib /opt/local/lib/mysql5/mysql/libmysqlclient_r.16.dylib ~/.rvm/gems/ruby-1.8.7-p352/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle

sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib ~/.rvm/gems/ruby-1.8.7-p352/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle

  • executed gem uninstall mysql2 and chose version 0.3.11 - the only version left in this RVM section is mysql2-0.2.7 .

Now everything works! Thanks again for the help.

Bash script to remove mysql-related files from Mac OS X (10.6 and 10.7).

 #!/bin/bash sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo rm -rf /Library/StartupItems/MySQLCOM sudo rm -rf /Library/PreferencePanes/My* sudo rm -rf ~/Library/PreferencePanes/My* sudo rm -rf /Library/Receipts/mysql* sudo rm -rf /Library/Receipts/MySQL* sudo rm -rf /var/db/receipts/com.mysql.* echo "Done." 

Copy in remove-mysql.sh , make it executable ( chmod +x remove-mysql.sh ) and run it.

+6
source share
6 answers

If you cannot find skip-locking in your my.cnf , it means MySQL is loading it from a path other than your expectations. Double check this.

PS It seems that you upgraded your MySQL from the old version, right?

+4
source

In one of the lines in the error log, it caught my attention.

 120209 0:02:23 [ERROR] mysqld: unknown option '--skip-locking' 

I think --skip-locking is a pretty old option .

Instead, you can replace this in my.cnf skip-external-locking

Since you removed --skip-locking , find findatir in my.cnf and make sure you specify which variables are where mysql data is located.

+3
source

It sounds (to me) as if you have permission problems.

Check perms in the following directories:

/ Usr / local / mysql / bin
/ Usr / local / mysql / data
/ Usr / local / mysql / enable
/ Usr / local / mysql / library
/ Usr / local / mysql / scripts
/ Usr / local / mysql / share
...
/ Usr / local / mysql / *

All of them must be read / write / called for mysql user and mysql group

More information about the installation layout: http://dev.mysql.com/doc/refman/5.5/en/macosx-installation-pkg.html#mysql-installation-layout-macosx

mysql_safe script: I think this can make the user switch to the "custom" mysql. More on this: http://dev.mysql.com/doc/refman/5.5/en/mysqld-safe.html

+2
source

Make sure your data directory is read / write mysql.

Try running mysqld_safe --skip-locking &

This should start on the server in the background. Then log in with "mysql" .. it should not ask for any credentials.

Check if you have any users defined in the mysql database user table.

You may need to manually add the user (as the grant system is bypassed above) using:

 use mysql insert into users <standard insert record stuff here> 

When done, exit the mysql client and do killall -s1 mysqld .. you may need to do killall -s 15 mysqld to get the job to complete. Please do not do -9 in poor old processes.

You can also use tasks / kill %%, etc.

+1
source

Try first

 sudo /Library/StartupItems/MySQLCOM/MySQLCOM start 

It looks like you need to install it correctly and let it create the necessary file for socks

0
source

Just run mysql_install_db from the /usr/local directory. See this blog post for more information.

0
source

Source: https://habr.com/ru/post/907289/


All Articles