I’ve just installed MySQL server 5.7 for FreeBSD 10.2 using pkg package manager. It seems the problem occur when I want to start the MySQL for the first time. This time I’m using the real VPS server and not VirtualBox. The error is : /usr/local/etc/rc.d/mysql-server: WARNING: failed precmd routine for mysql. Here is what happen to my VPS server.
The default installation from pkg package manager will be in /usr/local/ and the configuration file will be in /usr/local/etc/<your-package>. Some people will try to fix the problem by delete some line from /usr/local/etc/rc.d/mysql-server. I don’t know the result from deleting some line but I had try using this following method.
1. Fix ownership from my.cnf file in /usr/local/etc/mysql/my.cnf. Look the following figure from my VPS server.
Notice that the ownership of my.cnf is user: root and group: wheel. You have to change the ownership to user: mysql and group: mysql. Using following command:
# chown mysql:mysql /usr/local/etc/mysql/my.cnf
2. Next after change the ownership you can initialize the MySQL for the first time before we can use it for production use. New version of MySQL server using command mysqld –initialize for initialization than mysql_install_db. If you called only mysqld –initialize the command cannot be recognized by the shell because we don’t include the file path in the PATH variable. So you have to said using absolute path like this:
# /usr/local/libexec/mysqld –initialize
The following figure will make you understand how the process works.
You may notice that from the red square there is a temporary password for managing the MySQL server. But you have to understand that the MySQL server still doesn’t start. Now the next step is using this following command for starting the MySQL server:
# service mysql-server start
The following figure below will be the detail information.
Do the ps -ax | grep mysql for searching the MySQL server daemon and you can see that MySQL server is up and running.
3. Next write the temporary password from the generator before to /root/.mysql_secret and then do the following command for installing the tables and fix the secure installation
There will be questions you have to answer. The following figure will help you answer questions from MySQL installation.