# MySQL installation errors



## balanga (Jul 27, 2014)

I have only just installed FreeBSD (latest stable release) and am trying to set up a hosting server using Wordpress. The prerequisites are (L)AMP.

Apache seems to have been successfully installed, as does PHP, both using ports, but I'm stuck trying to get the MySQL server working. I have followed various links but it seems they are out of date. I tried using ports but that didn't work so did a deinstall and tried using `pkg install mysql56-server`.

What do I need to do to get it working?

*R*unning `/usr/local/etc/rc.d/mysql-server start` results in:

```
WARNING: failed precmd routine for mysql
```

Any help would be appreciated.


----------



## junovitch@ (Jul 27, 2014)

Incompatible cruft from a prior install perhaps?  The install/start works for me on a clean system.  If you haven't actually used it yet, try to `rm -r /var/db/mysql` and start again to let it create a fresh database.

Also, the supported default MySQL version is 5.5 right now.  Some software may have a dependency on that version and give you hassles trying to use 5.6.  If you want to use the publicly supported packages from the project you'll have an easier time using 5.5.


----------



## Carlos Trentini (Jun 14, 2016)

Hi there,

Install the mysql-server package of your choice, and then just run:
`/usr/local/libexec/mysqld --initialize`

After that, just start your MySQL service; don't forget to add it to the rc.conf.

Cheers.


----------



## SirDice (Jun 14, 2016)

Carlos Trentini said:


> Hi there,


Please look at the date of the thread before responding, this thread is almost 2 years old.



> Install the mysql-server package of your choice, and then just run:
> `/usr/local/libexec/mysqld --initialize`


This is not needed and may even cause problems. Simply start the service: `service mysql-server start`. If the databases need to be initialized (because it's the first time you start it) it will be done automatically by the rc(8) scripts.


----------



## Michel P (Jun 17, 2016)

SirDice said:


> This is not needed and may even cause problems.



Hi, ... well in my own experience, this is needed and actually solve problems, at least for the last install I have done : mysql57-server-5.7.12 / FreeBSD 10.3-Release (but you are right, it used to not be necessary in previous versions)
Please have a look : https://forums.freebsd.org/threads/56631/


----------

