Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

duggram

macrumors 6502
Original poster
Apr 17, 2008
391
11
When I try to start MySQL 5.1 in my NB 6.5.1 this is the error msg I get:

090326 10:04:40 [Warning] Can't create test file /usr/local/mysql-5.1.32-osx10.5-x86/data/DougMBP.lower-test
090326 10:04:40 [Warning] Can't create test file /usr/local/mysql-5.1.32-osx10.5-x86/data/DougMBP.lower-test
/usr/local/mysql-5.1.32-osx10.5-x86/bin/mysqld: Can't change dir to '/usr/local/mysql-5.1.32-osx10.5-x86/data/' (Errcode: 13)
090326 10:04:40 [ERROR] Aborting

090326 10:04:40 [Note] /usr/local/mysql-5.1.32-osx10.5-x86/bin/mysqld: Shutdown complete

Any suggestions on what I have set wrong?

After doing a google search I found this command:

sudo chown -R mysql /usr/local/mysql/*

This did not help at all.

So is the problem that mysql doesn't have permission to access the /data dir?
 
The location it's trying to access MySQL, is that where it's installed? I have MySQL through MAMP so mine is in a different spot. I'm assuming NB is NetBeans. When I connected NetBeans to MySQL I had to point the socket to MAMP's socket rather than the default location it was trying to connect to. I can't remember what error number it gave though so not sure if it's a similar problem.
 
Thanks for the prompt reply. Yes, NB is netbeans, and MySQL is looking to the correct directory. I think the problem is the permissions on the /data directory. MySQL is trying to write to that directory, or it's subs, and can't get it done because of permissions.

My problem is that I'm so new to UNIX I don't know how to get the permissions changed on those directories.
 
I searched around based on the error 13. Take a look at this thread, the guy found a solution to his issue by the bottom of the page. May not help, but give a clue perhaps.

One note on that command you tried from your original post. It was assuming a different location for your installation. You need to update the command to point to your install location;
Code:
sudo chown -R mysql /usr/local/mysql-5.1.32-osx10.5-x86/*
Not saying it will fix things ...
 
Thank you for the replys.

I found a way to set permissions in Finder. In Finder Go->Go To Folder..., enter /usr/local/. Finder then goes to the hidden folder. Click on the mysql folder, then data. "Get Info", unlock at bottom of window and set all privileges to R&W. Did the same for both subfolders.

Now MySQL can access the data folder. But now I get this error:

090327 2:17:23 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.1.32-osx10.5-x86/data/ is case insensitive
/usr/local/mysql-5.1.32-osx10.5-x86/bin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
090327 2:17:23 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: Log scan progressed past the checkpoint lsn 0 39548
090327 2:17:23 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 0 46409
090327 2:17:23 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
090327 2:17:23 InnoDB: Started; log sequence number 0 46409
090327 2:17:23 [ERROR] /usr/local/mysql-5.1.32-osx10.5-x86/bin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
090327 2:17:23 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
 
Man, that's a lot of different issues all at once.

In the first few lines MySQL realized certain important files were expected during runtime were not there (plugin.frm).

It then instructed you to "run mysql_upgrade" so you need to do that.

Most of the rest was MySQL fixing itself due to the missing files which previously corrupted the database, apparently. If you shut it down during processing as it thinks occured, I don't know, but clearly it attempted to resolve that issue and did.

Finally, the last line and any other references to "./mysql" concerns me, as your path actually is: "/usr/local/mysql-5.1.32-osx10.5-x86" but there might be a config file which thinks it's "/usr/local/mysql". Try the mysql_upgrade, restart it and see if any more errors, if so, let me know. I won't take action on this last thing until I see the log, but I want you to be aware of it. Meaning, wouldn't hurt to check the configuration to see if the wrong base path is configured or the MYSQL_HOME variable is set wrong.

-jim
 
Jim, I'm wondering if I should uninstall and try installing again?

DougMBP:~ duggram$ /usr/local/mysql-5.1.32-osx10.5-x86/bin/mysql_upgrade ; exit;Looking for 'mysql' as: /usr/local/mysql-5.1.32-osx10.5-x86/bin/mysql
Looking for 'mysqlcheck' as: /usr/local/mysql-5.1.32-osx10.5-x86/bin/mysqlcheck
Running 'mysqlcheck'...
/usr/local/mysql-5.1.32-osx10.5-x86/bin/mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed
logout

[Process completed]

Jim, there is no mysql.sock in /tmp/

-------------------------------------------------------------------------------

Then I tried the startup utility:

DougMBP:~ duggram$ sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
Password:
Starting MySQL database server
DougMBP:~ duggram$ cd /usr/local/mysql
DougMBP:mysql duggram$ sudo ./bin/mysqld_safe
090327 21:50:53 mysqld_safe Logging to '/usr/local/mysql-5.1.32-osx10.5-x86/data/DougMBP.local.err'.
090327 21:50:53 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.1.32-osx10.5-x86/data
090327 21:50:53 mysqld_safe mysqld from pid file /usr/local/mysql-5.1.32-osx10.5-x86/data/DougMBP.local.pid ended

Any suggestions?
 
Paths are okay as it turns out, permissions were not, upgrade failed and even safe mode startup failed. That's what I see. The errors during startup were logged to /usr/local/mysql-5.1.32-osx10.5-x86/data/DougMBP.local.err so check that file if you wish to debug further.

If you opt to unistall/reinstall, follow the explicit instructions and use files referenced on this page. I read a little of it, it's clear installing the Community version on Leopard isn't 100% the same as on other *nix platforms. So it might be worth it considering all the wacky errors you're getting all the time.

Or, uninstall and simply switch to MAMP which we all know works fine and the tweak its settings.

-jim
 
Jim,

Using Hivelogic's steps I have it installed but I don't have the control they talk about. I have start it with this command:

DougMBP:bin duggram$ sudo /usr/local/mysql/bin/mysqld_safe
Password:
090328 11:06:09 mysqld_safe Logging to '/usr/local/mysql/var/DougMBP.local.err'.
090328 11:06:09 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var

But I can't figure out how to get it to shutdown gracefully. BTW I know it's running because it shows up properly in NetBeans.

I can't use his plist and launchctl method. I did a google search on the error code and found that this is a common problem but no one seems to have a solution. The error code:

DougMBP:~ duggram$ sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist
launchctl: propertyList is NULL
launchctl: no plist was returned for: /Library/LaunchDaemons/com.mysql.mysqld.plist
launchctl: no plist was returned for: /Library/LaunchDaemons/com.mysql.mysqld.plist
nothing found to load

I followed his steps exactly many times. I used vi to create the file. Checked for each character in the file. Then I tried methods others suggested. Nothing works.

At the very least I have MySQL running. Now if I only had a way to shut it down without rebooting.

Thanks for all the suggestions.
 
That link I gave you was for a custom build of MySQL Community for Mac OS X. I've never installed this build, so based on your comments and the docs I'd ask you to check the following so you can auto and manual stop/start via terminal (as noted, preference pane, i.e. GUI based stop/start is not supported in this build):

1) Make sure you have Xcode installed before installing that build
2) When creating com.mysql.mysqld.plist do that via the Mac GUI using TextEdit or BBEdit, etc. and copy/paste the contents from the docs and save to the desktop. You mentioned "vi" and that is terminal mode from my experience, so right there it seems you strayed from the docs.
3) Then follow instructions to move/chown the plist file, launch/test to see if the monitor is running, etc. There is also help on manually starting and stopping, and I suspect if you do the plist setup stuff correctly you'll find those commands should work.

If not, this is your "last resort" or "emergency shutdown" procedure in terminal mode:

Try:

ps -aux | grep -i 'mysql' (or prefix that with sudo if you don't see mysql)

Then you should see any process ID's related to MySQL you installed.

Use:

kill -9 x (where x is the process ID in column 2 of the output, again sudo as necessary, repeat for all PID's until they're no longer listed via ps)

Note: This is how you kill any process on Leopard, but this is a dangerous way of doing it, i.e. you're not gracefully shutting down so any transactions not committed might be lost and scramble the DB. Plus, you still might need to use the "locate" command to find the mysql.pid or whatever named PID file this build generates and manually remove that also, so on the next startup of the daemon, it won't report problems due to an improper shutdown or PID related errors.

That's all the help I can possibly give! Good luck with it! :)

-jim
 
Jim, thanks for the advice. BTW vi produces text that is pure with no formatting code. It's actually a good choice for scripting. When I get the incentive I'll try to work on starting and stopping MySQL again. Until then I'm using your last ditch method.

Thank you,
Doug
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.