PhpMyadmin with PHP7

Configuring PHPMyAdmin with a fresh install of PHP7 and Apache

PhpMyadmin with PHP7

Note: this might be outdated as of 2018.

Start

		sudo apt-get install phpmyadmin

Link PhpMyAdmin

		sudo ln -s /usr/share/phpmyadmin /var/www

Php.ini

Make sure MuSQLi is loaded as a module in PHP

		sudo vi /etc/php/7.0/apache2/php.ini

Add this line to the bottom of the config (press the G key while in command mode)

		extension=mysqli.so

Setup PhpMyAdmin password

With PHP 7 you cannot run any processes as root which is also applied to the MySQL root user. For security you should create your own PhpMyAdmin account

1. Connect to mysql

sudo mysql --user=root mysql

2. Create a user for phpMyAdmin

Run the following commands (replacing some_pass by the desired password):

CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

If your phpMyAdmin is connecting to localhost, this should be enough.

3. Optional: allow remote connections

If you want an user with same privileges + remote connection privileges (be aware of security concerns), additionally run:

CREATE USER 'phpmyadmin'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

4. Update phpMyAdmin

Edit /etc/dbconfig-common/phpmyadmin.conf file updating user/password values in the following sections:

# dbc_dbuser: database user
#       the name of the user who we will use to connect to the database.
dbc_dbuser='phpmyadmin'

# dbc_dbpass: database user password
#       the password to use with the above username when connecting
#       to a database, if one is required
dbc_dbpass='some_pass'

Fin!