# FreeBSD 7.2, mysql_install_db script missing



## pyc (Oct 19, 2009)

I installed Mysql from ports regularily: 

```
# cd /usr/ports/databases/mysql51-server
# make install clean
```

But when I try to issue mysql_install_db, so it can make mysql dir and system databases, it's missing (is it some bug in mysql port?)... I'm new to FreeBSD, please help me, how can I solve this out?


----------



## SirDice (Oct 19, 2009)

Just create the directories, set them correctly in /etc/rc.conf (mysql_dbdir) and start mysql.


----------



## DutchDaemon (Oct 19, 2009)

Did you run [cmd=]rehash[/cmd] or [cmd=]hash -r[/cmd] after installing?


----------



## SirDice (Oct 19, 2009)

When I installed mysql51-server I didn't have to run mysql_install_db. 

Just created the datadir, set everything correctly in /etc/rc.conf, started mysql and set a root password for it.


----------



## pyc (Oct 19, 2009)

thanks... tried with rehash (doesn't work either)...
what directory i need to make and set in /etc/rc.conf?


----------



## SirDice (Oct 19, 2009)

pyc said:
			
		

> what directory i need to make and set in /etc/rc.conf?



Create a data dir where you want mysql to store the databases.
Set that dir with the variable mysql_dbdir in /etc/rc.conf.

Make sure the directory is owned by mysql:mysql.


----------



## DutchDaemon (Oct 19, 2009)

Note that MySQL uses /var/db/mysql by default. If your databases are already there, there's no need to alter /etc/rc.conf. Normally, you need nothing more than mysql_enable="YES".

[cmd=]ps axww | grep mysql[/cmd] tells you which directories it is using now.


----------



## pyc (Oct 19, 2009)

funny, when I try to chown mysql dir, I get this:


```
#chown -R mysql /var/db/mysql/
chown: mysql: Invalid argument
```

I guess it's because mysql user does not exist? So user must be made first?


----------



## DutchDaemon (Oct 19, 2009)

I'm pretty sure that the port adds the mysql user by itself.

```
mysql:*:88:88:MySQL Daemon:/nonexistent:/sbin/nologin
```


----------



## pyc (Oct 21, 2009)

Thank you all for help, in the end I concluded that was an unsuccessful build because I lacked swap memory (trying to make a server out of P1 200 Mhz / 64 MB RAM  ... and when I raised swap area, it was installed succesfully...


----------

