Today I was trying to install natika on my apache server. My server is a Fedora 22 machine. I know, it’s an old system, but if it works, why to change it? It’s a rhetorical question, of course. I know if I keep it like this for a longer time, nothing will run on it anymore. Anyway, here I am that I try to install natika via composer, and I don’t happen to have composer. You can easily fix that easily by dfn (or yum) install composer. This, in my case, installed on my server like 20 php packages and updates, so I’m not surprise the installation fails when I try
composer create-project asika/natika natika *
The interesting part is why it fails, and how to fix it. The error is on the interaction between the installer and the local mysql installation. More specifically, the error reads something similar to this one:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Now, this is one of the typical errors of mysql, when you do a careless install. Hell, I don’t remember when I did the install. It could be I did it 4 years ago. Am I careless? I could always log in on my local phpMyAdmin, so I didn’t care so much. Also
mysql -u root -p
seemed to work. Provided you give the right password. Since I installed just above a lot of new packages I decide to reset the root password using mysqld_safe:
systemctl stop mariadb.service mysqld_safe --skip-grant-tables
and now in a new terminal
mysql > update user set password=password('newpassword') where user='root'
Now I closed the first terminal and I try to restart mariadb. You can read the result by yourself.
systemctl start mariadb.service Job for mariadb.service failed. See "systemctl status mariadb.service" and "journalctl -xe" for details. ## > systemctl status mariadb.service ● mariadb.service - MariaDB 10.0 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since 11s ago Process: 9031 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=3) Process: 8915 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=1/FAILURE) Main PID: 8915 (code=exited, status=1/FAILURE) systemd: Starting MariaDB 10.0 database server... mysql-check-socket: Socket file /var/lib/mysql/mysql..... mysqld_safe: 170921 13:02:09 mysqld_safe Logging to mysqld_safe: 170921 13:02:09 mysqld_safe A mysqld ...
What is wrong here? Simple, the mysql_safe process didn’t stop when I closed the first terminal. Unfortunately, a PID kill doesn’t seem to be enough. We need to stop it using mysql commands. Again Stackoverflow provide us with the solution:
mysqladmin -u root -p shutdown
And now mariadb starts cleanly. Also, composer runs flawlessly. If I find something else interesting on that field, I will let you know as usual 🙂