Setting up mysql5

Ryan Schmidt ryandesign at macports.org
Sun Jan 31 00:02:35 PST 2010


On Jan 30, 2010, at 21:17, Harald Hanche-Olsen wrote:

> 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).

I think mysql_install_db5 should have created the grant tables and other required tables for you, but I haven't tried it lately.

We have more extensive MySQL setup instructions in the wiki; perhaps those are helpful:

http://trac.macports.org/wiki/howto/MAMP#mysql



More information about the macports-users mailing list