Tuesday, March 21, 2017

php, phpmyadmin on mariadb not working on ubuntu

Ever since Ubuntu upgraded to 16.04 with php 7 setting up LAMP server is not very difficult but getting it up is sometimes troublesome. specially running php7 because running php7 on apache also need to install mbstring and libapache2-mod-php you can use following commands on terminal to install these packages and within in no moment you will have your php working.
sudo apt install php libapache2-mod-php
sudo apt install php7.0-mbstring




Another problem that I encountered  us configuring it using mariadb as a database server. In maria db password for root is not set by default and you need to do it manually you can follow following instructions to get your mariadb working with phpmyadmin

Follow the steps below.
  1. Start the MySQL server with the --skip-grant-tables option
    $ mysqld --skip-grant-tables
  2. Execute these statements.
    $ mysql -u root mysql
    $mysql> UPDATE user SET Password=PASSWORD('password') where USER='root';
    $mysql> FLUSH PRIVILEGES;
    
If case you face the unknown field Password error :
update user set authentication_string=password('my_password') where user='root';
  1. Finally, restart the instance/daemon without the --skip-grant-tables option.
    $ /etc/init.d/mysql restart
    
You should now be able to connect with your new password.
$ mysql -u root -p


To install phpmyadmin use this command and follow onscreen instructions.
sudo apt install phpmyadmin


3 comments:

  1. you have tried everything on ubuntu 18.04 and php still not working. try following command.

    sudo a2enmod actions
    sudo service apache2 restart

    ReplyDelete
  2. ERROR 1698 (28000): Access denied for user 'root'@'localhost'

    ReplyDelete
  3. connect to mysql/mariadb using sudo command that may help..

    ReplyDelete

Setup MAMP (Mac Apache MySQL/MySQL DB PHP) on Mac OS Sonoma on Macbook (Silicon Chip)

Introduction Apple MacBook has gained popularity among developers in recent past. Many young developers are switching to Mac from Windows an...