# Mysql55-server on FreeBSD 8.2



## kenyloveg (Mar 2, 2011)

Hi, Fellows

 I'm moving from CentOS to FreeBSD now.

Now I'm trying to reproduce the Apache/Nginx/Mysql/Postgresql/PHP on FreeBSD-8.2-release.

Here is my step.

1. Install FreeBSD (minimal)
2. *portsnap fetch/extract/update*
3. *cd /usr/ports/database/mysql55-server*
4. *make install clean*
5. *cd /usr/local/bin*
6. *mysql_install_db*

Now I get error


```
FATAL ERROR: Could not find ./bin/my_print_defaults
```

but my_print_defaults does exist at /usr/local/bin/, then I edited basedir="" in mysql_install_db to basedir="/usr/local/bin". Then I get error

```
FATAL ERROR: Could not find my_print_defaults

The following directories were searched:

    /usr/local/bin/bin
    /usr/local/bin/extra
```

No idea how to move on...

Question is:

1. How do I know this is not a make script issue, where to find make procedure file?
http://www.freebsd.org/cgi/cvsweb.cgi/ports/databases/mysql55-server/

2. Where are these files? Can you tell me where is configuration/binary stored on FreeBSD after an application is installed?

Thanks and have a good day.


----------



## SirDice (Mar 2, 2011)

No need to run *install_db*, it will be automatically started when mysql starts for the first time.


----------



## canes305 (Mar 29, 2011)

It works if you specify the --basedir option. I would highly advise against modifying the Makefile or *mysql_install_db* script.

[cmd=]#mysql_install_db --user=mysql --basedir=/usr/local[/cmd]


----------



## gohmdoree (May 27, 2011)

*MYSQL Install/Upgrade [FATAL ERROR: Could not find my_print_defaults]*

I did an update from MySQL 5.1 to 5.5.  I didn't follow a particular upgrade path.  I backed up my databases, then uninstalled and installed thew newer version.

I reused my my.cnf from earlier.

```
[client]
port		= 3306
socket		= /tmp/mysql.sock
password	= n!xxx0n

[mysqld]
port		= 3306
socket		= /tmp/mysql.sock
#skip-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

log-bin=mysql-bin

binlog_format=mixed

server-id	= 1

log-bin=mysql-bin

tmpdir		= /tmp/		

innodb_data_home_dir = /var/db/mysql/
innodb_data_file_path = ibdata1:7G;ibdata2:7G;ibdata3:7G;ibdata4:7G;ibdata5:7G
innodb_log_group_home_dir = /var/db/mysql/
innodb_buffer_pool_size = 1G
innodb_additional_mem_pool_size = 250M

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout
```

I didn't have any issues with 5.1, but with 5.5, I get the startup error:


```
110527 16:14:33 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
/usr/local/libexec/mysqld: Table 'mysql.plugin' doesn't exist
110527 16:14:33 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110527 16:14:33 InnoDB: The InnoDB memory heap is disabled
110527 16:14:33 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110527 16:14:33 InnoDB: Compressed tables use zlib 1.2.3
110527 16:14:33 InnoDB: Initializing buffer pool, size = 1.0G
110527 16:14:34 InnoDB: Completed initialization of buffer pool
110527 16:14:34 InnoDB: highest supported file format is Barracuda.
110527 16:14:34  InnoDB: Waiting for the background threads to start
110527 16:14:35 InnoDB: 1.1.6 started; log sequence number 1595670
110527 16:14:35 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
110527 16:14:35 mysqld_safe mysqld from pid file /var/db/mysql/daisy.localdomain.pid ended
```

I figured I had to recreate the databases with mysql_install_db.  Doing so, I had got these errors:


```
FATAL ERROR: Could not find ./bin/my_print_defaults
```

My install put it in /usr/local/bin.  I added some options to mysqld_install_db:


```
mysql_install_db --verbose --user=mysql --basedir=/usr/local/bin --datadir=/var/db/mysql --tmpdir=/tmp
```

But that just gives:


```
FATAL ERROR: Could not find my_print_defaults

The following directories were searched:

    /usr/local/bin/bin
    /usr/local/bin/extra
```

I'm kind of stumped and thinking of just going back to 5.1.  Any pointers on this?  What am I missing?


----------



## gohmdoree (May 28, 2011)

My first mistake was the basedir.


----------



## sp00kd (Jun 24, 2011)

*Change to the BaseDir*

It works if you *cd* to the basedir, and then execute the install_db script.

`# cd /usr/local`
`# mysql_install_db`


----------

