Step 3: Install MariaDB 10 in Ubuntu 16.04
11. Now is time to install MariaDB database with the necessary PHP modules in order to use and access the database from Apache-PHP interface by issuing the below command on your machine console.
$ sudo apt install php7.0-mysql mariadb-server mariadb-client
12. After the installation of MariaDB is complete, run the below security script witch will secure the database (set a root password and answer with yes on all the questions in order to remove anonymous access, disable root login remotely and delete the test database).
$ sudo mysql_secure_installation
13. In order to setup or change MariaDB so that ordinary users can access the database without system sudo privileges, enter to MySQL command line interface with root privileges and issue the below commands:
$ sudo mysql MariaDB> use mysql; MariaDB> update user set plugin=’‘ where User=’root’; MariaDB> flush privileges; MariaDB> exit
Then, restart MySQL service and try to login to database without root privileges by executing the below commands:
$ sudo systemctl restart mysql.service $ mysql -u root -p
Step 4: Install PhpMyAdmin in Ubuntu 16.04
14. Optionally, if you need to manage MySQL database from a web graphical interface (which we don’t recommend on production servers) install Phpmyadmin package by running the below command.
$ sudo apt install php-gettext phpmyadmin
During the installation choose to automatically configure phpmyadmin with apache2 web server, choose No on Configure database for phpmyadmin with dbconfig-common and setup a strong password for the web interface.
15. Finally, after the installation of phpmyadmin package finishes you can access Phpmyadmin web interface by visiting the below URL:
https://your_server_IP_address/phpmyadmin/
That’s all! Now you have a fully LAMP stack environment installed and running on Ubuntu 16.04, which allows you to create and deploy dynamic websites on your server.
Excellent tutorial – worked without issue on XUBUNTU 16.04 which is a rarety.
I got everything installed but phpmyadmin is in /etc instead of /var/www/html where it should have gone to I think. Also it didn’t accept my password for root. Can I reinstall phpmyadmin somehow? When I run the command for installing it, it tells me that it’s already the newest and cannot be upgreaded.
Thank you.
Use sudo dpkg-reconfigure phpmyadmin. No, by default, phpmyadmin installed from binaries does not use /var/ww/html directory for installation and uses /etc only for configuration . The source files reside in /usr/share/phpmyadmin usually.
I get the following error message when running the command you advised.
┌────┤ Configuring phpmyadmin ├─────────────┐
│ An error occurred while installing the database: │
│ │
│ ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO) . Your options are: │
│ * abort – Causes the operation to fail; you will need to downgrade, │
│ reinstall, reconfigure this package, or otherwise manually intervene │
│ to continue using it. This will usually also impact your ability to │
│ install other packages until the installation failure is resolved. │
│ * retry – Prompts once more with all the configuration questions │
│ (including ones you may have missed due to the debconf priority │
│ setting) and makes another attempt at performing the operation. │
│ * retry (skip questions) – Immediately attempts the operation again, │
│ skipping all questions. This is normally useful only if you have │
│ solved the underlying problem since the time the error occurred. │
│ * ignore – Continues the operation ignoring dbconfig-common errors. │
│ This will usually leave this package without a functional database. │
│ │
│ Next step for database installation: │
│ │
│ abort │
│ retry │
│ retry (skip questions) │
│ ignore │
│ │
│ │
│ │
│ │
└───────────────────────────────────┘
Choose retry (skip questions). If there are still issues with phpmyadmin, then completley remove the package with sudo apt remove –purge phpmyadmin and manually install phpmyadmin from sources.
Found my problem , I did not execute this script because the purpose was not clear for me. After replacing the quote ’ by ‘ , I can execute those commands. Access to phpmyadmin is OK now, but I still don’t know why ;-)
$ sudo mysql
MariaDB> use mysql;
MariaDB> update user set plugin=’‘ where User=’root’;
MariaDB> flush privileges;
MariaDB> exit
Probably because you’ve used copy-paste the commands from here directly on mysql prompt. Always enter commands manually and pay attention to syntax, especially quotes.
Hi
For phpmyadmin, if you “choose No on Configure database for phpmyadmin with dbconfig-common ” , you cannot “setup a strong password for the web interface”. You have to say YES then you can enter password.
By the way, nice tutorial, even if I miss some explanation. At the end, just login into phpmyadmin gave me problem, as root or my user, can’t login.
I will have to restart and look what is the problem,
Thanks for your work
Philippe