I’ve just installed MySQL server 5.7 for FreeBSD 10.2 using pkg package manager. It seems the problem occurred when I went to start 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:ailed precmd routine for mysql
Here is what happened to my VPS server.
The default installation from pkg package manager will be in /usr/local/ and the configuration file will be in
Some people will try to fix the problem by deleting some line from /usr/local/etc/rc.d/mysql-server. I don’t know the result from deleting some line but I had to try using the following method.
1. Fix ownership from my.cnf file in
Look at 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 the following command:
# chown mysql:mysql /usr/local/etc/mysql/my.cnf
2. Next after changing the ownership you can initialize MySQL for the first time before we can use it for production use. The new version of MySQL server uses command mysqld –initialize for initialization instead of 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 vari- able. So you have to use an absolute path like this:
# /usr/local/libexec/mysqld –initialize
3. The following figure will help 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 the 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.
About the Author:
My name is Andrey Ferriyan. I’m a writer, re- searcher and practitioner. Python and R en- thusiast. Experiences in UNIX-like servers (GNU/Linux, FreeBSD and OpenBSD). Data Scientist wannabe. Area of interests including Information Security, Governance of Enterprise IT, Machine Learning and Data Mining. Now I’m a student at Keio Uni- versity under LPDP (Indonesia Endowment Fund for Education). I lead startup company in Indonesia called ATSOFT (atsoft.co.id) with my friends. I speak in English and Indo- nesian.
The article comes from Andreys blog:
The article has been published in BSD Mag Vol. 10 No. 06 (82).