ERROR: 1004 Can't create file '/var/tmp/#sqlcf9_1_0.frm' (errno: 9)

Ryan Schmidt ryandesign at macports.org
Sun Dec 5 08:17:22 PST 2010


On Dec 5, 2010, at 09:57, Sebastian Wojtowicz wrote:

> I cleaned my disk and reinstalled Mac OSX. Followed by the following actions.
> Why isn't this working ? Is the mysql port defect ?

It works fine for me, though I haven't tried following the initial setup instructions in years; I set up my MySQL server long ago and it just keeps working.


> * sudo port install mysql5 +server

The mysql5 port does not have a variant called +server. (Check "port variants mysql5".) It did, years ago, but this was changed to a separate port called mysql5-server, so you should install that. mysql5-server should set up directories, users and permissions properly.


> * sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql
> Password:
> Installing MySQL system tables...
> ERROR: 1004  Can't create file '/var/tmp/#sqla0_1_0.frm' (errno: 9)
> 101205 16:04:06 [ERROR] Aborting
> 
> 101205 16:04:06 [Note] /opt/local/libexec/mysqld: Shutdown complete
> [...and more text...]
> * sudo /opt/local/lib/mysql5/bin/mysqld_safe &
> [1] 260
> Sebastian-Wojtowiczs-MacBook:~ Allisone$ 101205 16:12:36 mysqld_safe Logging to '/opt/local/var/db/mysql5/Sebastian-Wojtowiczs-MacBook.local.err'.
> mkdir: /opt/local/var/run: No such file or directory
> chown: /opt/local/var/run/mysql5: No such file or directory
> chmod: /opt/local/var/run/mysql5: No such file or directory
> 101205 16:12:36 mysqld_safe Starting mysqld daemon with databases from /opt/local/var/db/mysql5
> 101205 16:12:42 mysqld_safe mysqld from pid file /opt/local/var/db/mysql5/Sebastian-Wojtowiczs-MacBook.local.pid ended
> 
> * sudo mkdir /opt/local/var/run
> * sudo chmod g+w /opt/local/var/run
> * sudo mkdir /opt/local/var/run/mysql5
> * sudo chown mysql /opt/local/var/run/mysql5
> * mysqladmin5 -u root -p ping
> Enter password: 
> mysqladmin5: connect to server at 'localhost' failed
> error: 'Access denied for user 'root'@'localhost' (using password: NO)'
> * /opt/local/lib/mysql5/bin/mysqladmin -u root password 'mypass'
> /opt/local/lib/mysql5/bin/mysqladmin: connect to server at 'localhost' failed
> error: 'Access denied for user 'root'@'localhost' (using password: NO)'
> 
> * sudo chown -R mysql:mysql /opt/local/var/db/mysql5
> * sudo chmod u+rwx,go= /opt/local/var/db/mysql5

The above is some of what the mysql5-server port would have set up for you. (That is, it creates the directories and sets their ownership and permissions; I haven't verified that the ownership and permissions the mysql5-server port sets them to is identical to what you've used above.)


> * sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql
> Installing MySQL system tables...
> OK
> Filling help tables...
> OK
> [...and more text...]
> * mysqladmin5 -u root password
> mysqladmin5: connect to server at 'localhost' failed
> error: 'Access denied for user 'root'@'localhost' (using password: NO)'

This makes it sound like the root user already has a password, or the permission tables didn't get loaded properly by mysql_install_db. I'm not certain how to debug this further.


You know, we do have a MySQL how-to in our wiki... have you tried following that?

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




More information about the macports-users mailing list