Setting up mysql5

Harald Hanche-Olsen hanche at math.ntnu.no
Sat Jan 30 19:17:05 PST 2010


I just installed mysql5. Compiling it went fine, and running it seems
to be no problem using the supplied launchd item.

However, I am unable to connect to the database:

; mysql5 -h localhost -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

After messing around a bit (actually, several hours went down the
drain doing this), finally running the server using the extra flag
--skip-grant-tables, I found out that the table mysql.user had no rows
at all. Adding data to this table by hand I now finally have a root
user, hopefully with all the necessary privileges (time will show).

Surely, this is not how the mysql setup is supposed to go. I must
have done something wrong somewhere, but can't figure out where.

This is basically what I did:

#; port -v install mysql5-server
[...]
#; launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
#; /opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'
[... produced an access denied error like the one below
 ... but I seem to have closed that terminal window, so no copy ...]
; mysql5 -h localhost -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

It did not seem to make any difference whether or not I ran
; sudo -u _mysql mysql_install_db5
(as recommended at the end of installation) before launchctl load.

FWIW: This is macports version 1.8.2 on OS X 10.5.8 (intel).

- Harald


More information about the macports-users mailing list