can't start MySql in Mac OS 10.6 Snow Leopard

2019-01-13 00:36发布

I've googled this and could'nt find anything new and useful for Apple's new OS SnowLeopard. I wonder if this is my mistake or I do need to do something?

this is what I did:

Downloaded from mysql site: http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg I choose : Mac OS X 10.5 (x86_64)

I run all the packages and installed all of them. So now I certainly have mysql in

/usr/local/mysql/

But when trying to start it from preferences panel, it is always STOPPED. When I try to do (in the terminal):

/usr/local/mysql/bin/mysql

I got :

-bash: /usr/local/mysql/bin/mysql: Bad CPU type in executable

What is wrong here? Any help would be very appreciated. Thanks

16条回答
爷、活的狠高调
2楼-- · 2019-01-13 01:18

I'd guess that your iMac isn't 64-bit (you state in another thread it is an original white intel iMac). Try the 32-bit version of MySQL–it should install directly over the 64-bit version, I think.

How to tell if your Intel-based Mac has a 32-bit or 64-bit processor
http://support.apple.com/kb/HT3696

查看更多
Deceive 欺骗
3楼-- · 2019-01-13 01:22

Maybe this answer helps:

mysql5.58 unstart server in mac os 10.6.5

I just installed MySQL 5.5.8 (mysql-5.5.8-osx10.6-x86_64.dmg) on Mac os X 10.6.5 and also had the problem that MySQL was not starting.

After reading this post: http://forums.mysql.com/read.php?11,399397,399606#msg-399606 and editing the file as suggested everything started working.

I also did

sudo chown -R root:wheel /Library/StartupItems/MySQLCOM

after reading http://discussions.info.apple.com/message.jspa?messageID=12820394#12820394 since when restarting my Mac OSx 10.6.6 it kept on asking something about not enough privileges. The line above solved that issue.

Now everything is working.

查看更多
家丑人穷心不美
4楼-- · 2019-01-13 01:22

First of all can I just say that I really really love the Internet community for all that it does in providing answers to everybody. I don't post a lot but everybody's posting here and on so many boards helped me so much! None of them gave me the right answer mind you, but here is my unique solution to this nightmare of a spending 2 solid days trying to install MySQL 5.5.9 on Snow Leopard 10.6. Skip to bottom for resolution.

Here's what happened.

I had a server crash recently. The server was rebuilt and of course MySQL 5.5.8 didn't work. What a worthless piece. I had 5.1.54 on my other machine. That had been a pain to install as well but not like this.

I had all sorts of issues installing with the dmg from mysql.org, installing mysql5 using macports, uninstalling trying to revert to 5.1.54 (couldn't because I couldn't find the receipt file with that info even though I followed the directions). After rming everything I could find related to mysql and then reinstalling 5.5.8 everything worked! Until I rebooted... ☹ I looked in my system preference mysql pane and found mysql server wasn't starting. (skip to end for resolution)

My first error (super common) included: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' and numerous other EXTREMELY common issues related to mysql.sock http://forums.mysql.com/read.php?11,9689,13272

Here were things I tried: 1)Create /etc/my.cnf file with the proper paths to mysql.sock. I even tried modifying mysql.server with vi directly. Modifying the php.ini was worthless. Nothing worked because MySQL wasn't starting, therefore it wasn't creating mysql.sock in the first place. Maybe you can point to the directory it is being created, and not the actual full file path i.e. not /tmp/mysql.sock but /tmp It was suggested but wasn't working because there was no mysql.sock because mysqld wasn't spawning.

2)Basedir and datadir modifications didn't work because there was no mysql.sock to point too.

Why? Because the mysql daemon wasn't starting. Without anything to start mysqld and thereby create mysql.sock I was doomed. They are an important part of the solution but if you try them and still get errors, you will know why.

3)sudo chown -R root:wheel /Library/StartupItems/MySQLCOM/

didn't solve my problem. I ended up having that folder and all items set to root:wheel though in the end, because it was one of the many things recommended and its working. Maybe it could remain _mysql but wheel works.

4)Copy mysql.sock from another machine. Doesn't work. I had searched and searched my new machine and couldn't find mysql.sock. I was using find / | grep mysql.sock because locate mysql wasn't finding anything. Besides I was trying so many different things it wasn't updating enough to find my new installs. I now like find much more than locate, even though you can update the locate db. Anyhow you can't copy mysql.sock, even if you tar it because its a 0 byte file.

THE RESOLUTION: I finally stumbled onto the solution. I finally just typed mysqld from command line while I was in the proper bin directory. It said another process was running. _mysql was spawning a process that I could see in the Activity Monitor. I killed the active mysql process and when I typed mysqld again I found it was creating my mysql.sock file in the /private/tmp/mysql.sock

The mysql pref pane wouldn't start the right process on login, so I just disabled that for being worthless. It wouldn't start mysql because no mysql.sock was being created.

By then I had figured out that mysqld creates mysql.sock. I then found /opt/local/mysql/ and typed "open bin" in the terminal window. This opened the directory with mysqld in it.

I went to login items in the system preferences in my account settings and dragged and dropped the mysqld file onto the startup items there. THAT worked. Finally!

It works flawlessly because mysqld is starting up at login, which means mysql.sock is being created so no more errors about not being able to find mysql.sock.

查看更多
趁早两清
5楼-- · 2019-01-13 01:24

I'm not entirely sure why my MySQL installation stopped working but it started trying to run as the incorrect user, as mysql instead of _mysql

Here was my error output:

140422 14:46:14 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
140422 14:46:14 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
140422 14:46:14 [ERROR] Fatal error: Can't change to run as user 'mysql' ;  Please check that the user exists!

140422 14:46:14 [ERROR] Aborting

140422 14:46:14 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

The fix for me was to edit /usr/local/mysql/bin/mysqld_safe and set the user line at the top from:

user='mysql'

to

user='_mysql'

That line was on line 25 for me with mysql-5.5.37-osx10.6-x86_64

查看更多
相关推荐>>
6楼-- · 2019-01-13 01:26

YOU MUST REINSTALL mySQL after upgrading to Snow Leopard and remove any previous versions as well as previous startup from the preference panel. install 86_64 10.5...I find the others did not work for me.

  1. Download MySQL version Mac OS X 10.5 (x86_64) located at http://dev.mysql.com/downloads/mysql/5.4.html#macosx-dmg
  2. Install startup Item (follow instructions)
  3. Then install the beta version (follow instructions)
  4. If you want the start up in the Preference Panel...install mySQL.prefpane I find that SQL does not run from the terminal unless you start mySQL in the preference panel.
查看更多
▲ chillily
7楼-- · 2019-01-13 01:26

Along with making sure you install the 64bit version, also check to make sure that the symbolic link of '/usr/local/mysql' is pointing to the correct version of your installation:

lrwxr-xr-x   1 root  wheel    27B Aug 29 01:24 mysql -> mysql-5.1.37-osx10.5-x86_64
drwxr-xr-x   3 root  wheel   102B Aug 29 01:25 mysql-5.1.30-osx10.5-x86
drwxr-xr-x  11 root  wheel   374B Aug 29 15:59 mysql-5.1.37-osx10.5-x86_64
drwxr-xr-x  17 root  wheel   578B Jul 13 22:06 mysql-5.1.37-osx10.5-x86_64.old

Alos, I found that after my installation, even though I used the pkg file from MySQL various other libraries would not build against the installation. The solution was to follow the steps to build MySQL from source found here. You can manually start it as root with the command:

/usr/loca/mysql/bin/mysqld_safe [whatever options you use]

Now ... to get the preference pane working I did the following:

  1. Installed 64bit version of MySQL Server packet from mysql.com
  2. Moved the package from mysql-5.1.37-osx10.5-x86_64 to mysql-5.1.37-osx10.5-x86_64.old
  3. Did a manual compile and installation of MySQL as per these instructions
  4. Executed the following command:

    sudo cp -R /usr/local/mysql-5.1.37-osx10.5-x86_64.old/support-files /usr/local/mysql/.

  5. Opened up the MySQL Preference Pane and tada! it works

查看更多
登录 后发表回答