MacPorts MySQL Installation of system tables failed!
Some problems installing MySQL using macports on Mac OS X: After macports install, trying to run mysql_install_db
results in error:
$ sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql
Installing MySQL system tables...
ERROR: 1004 Can't create file '/var/tmp/#sql10274_1_0.frm' (errno: 9)
120609 22:53:01 [ERROR] Aborting
120609 22:53:01 [Note] /opt/local/libexec/mysqld: Shutdown complete
Installation of system tables failed!
To solve that, we need to change some permissions:
$ sudo chown -R mysql:mysql /opt/local/var/db/mysql5
$ sudo chmod u+rwx,go= /opt/local/var/db/mysql5
Then try again:
$ sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
The default tables should now be properly filled. Then you should be able to execute the mysqladmin command to set the new root password as described in the output from mysql_install_db
:
$ /opt/local/lib/mysql5/bin/mysqladmin -u root password newpassword
If you get the Access denied for user 'root'@'localhost'
error, make sure you have restarted mysql after successfully executing the mysql_install_db
script.